From c67e90c5bfd10defde9259aa77ad79af3503f92d Mon Sep 17 00:00:00 2001 From: alexcesaro Date: Mon, 20 Oct 2014 17:34:59 +0200 Subject: [PATCH] Fixed header date fields format --- gomail.go | 2 +- gomail_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gomail.go b/gomail.go index 9f96b62..79d4714 100644 --- a/gomail.go +++ b/gomail.go @@ -141,7 +141,7 @@ func (msg *Message) SetDateHeader(field string, date time.Time) { // FormatDate formats a date as a valid RFC 5322 date. func (msg *Message) FormatDate(date time.Time) string { - return date.Format(time.RFC822) + return date.Format(time.RFC822Z) } // GetHeader gets a header field. diff --git a/gomail_test.go b/gomail_test.go index ddf25d7..694374b 100644 --- a/gomail_test.go +++ b/gomail_test.go @@ -37,8 +37,8 @@ func TestMessage(t *testing.T) { }, content: "From: =?UTF-8?Q?Se=C3=B1or_From?= \r\n" + "To: =?UTF-8?Q?Se=C3=B1or_To?= , tobis@example.com\r\n" + - "X-Date: 25 Jun 14 17:46 UTC\r\n" + - "X-Date-2: 25 Jun 14 17:46 UTC\r\n" + + "X-Date: 25 Jun 14 17:46 +0000\r\n" + + "X-Date-2: 25 Jun 14 17:46 +0000\r\n" + "X-Headers: Test, =?UTF-8?Q?Caf=C3=A9?=\r\n" + "Subject: =?UTF-8?Q?=C2=A1Hola,_se=C3=B1or!?=\r\n" + "Content-Type: text/plain; charset=UTF-8\r\n" + @@ -494,7 +494,7 @@ func stubSendMail(t *testing.T, bCount int, emails ...message) SendMailFunc { got := string(msg) wantMsg := string("Mime-Version: 1.0\r\n" + - "Date: 25 Jun 14 17:46 UTC\r\n" + + "Date: 25 Jun 14 17:46 +0000\r\n" + want.content) if bCount > 0 { boundaries := getBoundaries(t, bCount, got)