Fixed date headers

Closes #21.
This commit is contained in:
Alexandre Cesaro 2015-02-28 16:46:44 +01:00
parent 6805982221
commit c7ca0f5da9
3 changed files with 5 additions and 5 deletions

View File

@ -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.

View File

@ -37,8 +37,8 @@ func TestMessage(t *testing.T) {
},
content: "From: =?UTF-8?Q?Se=C3=B1or_From?= <from@example.com>\r\n" +
"To: =?UTF-8?Q?Se=C3=B1or_To?= <to@example.com>, 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)

View File

@ -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" +