From c7ca0f5da9bd757d931ec3e4bc6180b553314674 Mon Sep 17 00:00:00 2001 From: Alexandre Cesaro Date: Sat, 28 Feb 2015 16:46:44 +0100 Subject: [PATCH] Fixed date headers Closes #21. --- gomail.go | 2 +- gomail_test.go | 6 +++--- send_test.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gomail.go b/gomail.go index bb70e97..1466943 100644 --- a/gomail.go +++ b/gomail.go @@ -144,7 +144,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.RFC822Z) + return date.Format(time.RFC1123Z) } // GetHeader gets a header field. diff --git a/gomail_test.go b/gomail_test.go index d03b9fb..a7518bb 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 +0000\r\n" + - "X-Date-2: 25 Jun 14 17:46 +0000\r\n" + + "X-Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" + + "X-Date-2: Wed, 25 Jun 2014 17:46:00 +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" + @@ -528,7 +528,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 +0000\r\n" + + "Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" + want.content) if bCount > 0 { boundaries := getBoundaries(t, bCount, got) diff --git a/send_test.go b/send_test.go index 23a3db2..7f074bc 100644 --- a/send_test.go +++ b/send_test.go @@ -23,7 +23,7 @@ var ( const wantMsg = "To: to1@example.com, to2@example.com\r\n" + "From: from@example.com\r\n" + "Mime-Version: 1.0\r\n" + - "Date: 25 Jun 14 17:46 +0000\r\n" + + "Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" + "Content-Type: text/plain; charset=UTF-8\r\n" + "Content-Transfer-Encoding: quoted-printable\r\n" + "\r\n" +