From ae15a12ce568a990715a2345931503f04ca6c0f2 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Sat, 26 Oct 2024 19:57:02 +0200 Subject: [PATCH] Refactor SetDate to use SetDateWithValue Replaces direct time formatting in SetDate with a call to SetDateWithValue, improving code reusability and readability. The new approach centralizes date formatting logic in one method. --- msg.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/msg.go b/msg.go index c96bfac..e19f8e5 100644 --- a/msg.go +++ b/msg.go @@ -1087,8 +1087,7 @@ func (m *Msg) SetBulk() { // - https://datatracker.ietf.org/doc/html/rfc5322#section-3.3 // - https://datatracker.ietf.org/doc/html/rfc1123 func (m *Msg) SetDate() { - now := time.Now().Format(time.RFC1123Z) - m.SetGenHeader(HeaderDate, now) + m.SetDateWithValue(time.Now()) } // SetDateWithValue sets the "Date" header for the Msg using the provided time value in a valid RFC 1123 format.