-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct MIME-Version header casing (#83)
* fix: correct MIME-Version header casing https://www.w3.org/Protocols/rfc1341/3_MIME-Version.html * test: correct MIME-Version header casing
- Loading branch information
Showing
2 changed files
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ func TestMailYakFromHeader(t *testing.T) { | |
} | ||
} | ||
|
||
// TestMailYakWriteHeaders ensures the Mime-Version, Date, Reply-To, From, To and | ||
// TestMailYakWriteHeaders ensures the MIME-Version, Date, Reply-To, From, To and | ||
// Subject headers are correctly wrote | ||
func TestMailYakWriteHeaders(t *testing.T) { | ||
t.Parallel() | ||
|
@@ -88,7 +88,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"Test", | ||
"[email protected]", | ||
true, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nReply-To: [email protected]\r\nSubject: Test\r\nTo: [email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nReply-To: [email protected]\r\nSubject: Test\r\nTo: [email protected]\r\n", | ||
}, | ||
{ | ||
"No reply-to", | ||
|
@@ -98,7 +98,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"", | ||
"", | ||
true, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected]\r\n", | ||
}, | ||
{ | ||
"Multiple To addresses", | ||
|
@@ -108,7 +108,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"", | ||
"", | ||
true, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\n", | ||
}, | ||
{ | ||
"Single Cc address, Multiple To addresses", | ||
|
@@ -118,7 +118,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"", | ||
"", | ||
true, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nCC: [email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nCC: [email protected]\r\n", | ||
}, | ||
{ | ||
"Multiple Cc addresses, Multiple To addresses", | ||
|
@@ -128,7 +128,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"", | ||
"", | ||
true, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nCC: [email protected],[email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nCC: [email protected],[email protected]\r\n", | ||
}, | ||
{ | ||
"Single Bcc address, Multiple To addresses", | ||
|
@@ -138,7 +138,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"", | ||
"", | ||
true, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nBCC: [email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nBCC: [email protected]\r\n", | ||
}, | ||
{ | ||
"Multiple Bcc addresses, Multiple To addresses", | ||
|
@@ -148,7 +148,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"", | ||
"", | ||
true, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nBCC: [email protected],[email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nBCC: [email protected],[email protected]\r\n", | ||
}, | ||
{ | ||
"Multiple Bcc addresses, Multiple To addresses", | ||
|
@@ -158,7 +158,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"", | ||
"", | ||
false, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\n", | ||
}, | ||
{ | ||
"All together now", | ||
|
@@ -168,7 +168,7 @@ func TestMailYakWriteHeaders(t *testing.T) { | |
"", | ||
"", | ||
true, | ||
"From: Dom <[email protected]>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nCC: [email protected],[email protected]\r\nBCC: [email protected],[email protected]\r\n", | ||
"From: Dom <[email protected]>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: [email protected],[email protected]\r\nCC: [email protected],[email protected]\r\nBCC: [email protected],[email protected]\r\n", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
|
@@ -307,7 +307,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"", | ||
"", | ||
"", | ||
"From: \r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
"From: \r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
{ | ||
|
@@ -319,7 +319,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"", | ||
"", | ||
"", | ||
"From: \r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n--alt\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/html; charset=UTF-8\r\n\r\nHTML\r\n--alt--\r\n\r\n--mixed--\r\n", | ||
"From: \r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n--alt\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/html; charset=UTF-8\r\n\r\nHTML\r\n--alt--\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
{ | ||
|
@@ -331,7 +331,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"", | ||
"", | ||
"", | ||
"From: \r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n--alt\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/plain; charset=UTF-8\r\n\r\nPlain\r\n--alt--\r\n\r\n--mixed--\r\n", | ||
"From: \r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n--alt\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/plain; charset=UTF-8\r\n\r\nPlain\r\n--alt--\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
{ | ||
|
@@ -343,7 +343,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"", | ||
"", | ||
"reply", | ||
"From: \r\nMime-Version: 1.0\r\nDate: " + now + "\r\nReply-To: reply\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
"From: \r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nReply-To: reply\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
{ | ||
|
@@ -355,7 +355,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"", | ||
"name", | ||
"", | ||
"From: name <>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
"From: name <>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
{ | ||
|
@@ -367,7 +367,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"addr", | ||
"name", | ||
"", | ||
"From: name <addr>\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
"From: name <addr>\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
{ | ||
|
@@ -379,7 +379,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"from", | ||
"", | ||
"", | ||
"From: from\r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
"From: from\r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
{ | ||
|
@@ -391,7 +391,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"", | ||
"", | ||
"", | ||
"From: \r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: subject\r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
"From: \r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: subject\r\nTo: \r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
{ | ||
|
@@ -403,7 +403,7 @@ func TestMailYakBuildMime(t *testing.T) { | |
"", | ||
"", | ||
"", | ||
"From: \r\nMime-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: one,two\r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
"From: \r\nMIME-Version: 1.0\r\nDate: " + now + "\r\nSubject: \r\nTo: one,two\r\nContent-Type: multipart/mixed;\r\n\tboundary=\"mixed\"; charset=UTF-8\r\n\r\n--mixed\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"alt\"\r\n\r\n\r\n--mixed--\r\n", | ||
false, | ||
}, | ||
} | ||
|