forked from DusanKasan/parsemail
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ryotosaito/master
Decode text/plain and text/html body with encoding
- Loading branch information
Showing
2 changed files
with
101 additions
and
4 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 |
---|---|---|
|
@@ -403,6 +403,31 @@ So, "Hello".`, | |
htmlBody: "<div dir=\"ltr\"><div>Time for the egg.</div><div><br></div><div><br><br></div></div>", | ||
textBody: "Time for the egg.", | ||
}, | ||
14: { | ||
contentType: "multipart/alternative; boundary=\"000000000000ab2e1f05a26de586\"", | ||
mailData: base64Content, | ||
subject: "Saying Hello", | ||
from: []mail.Address{ | ||
{ | ||
Name: "John Doe", | ||
Address: "[email protected]", | ||
}, | ||
}, | ||
sender: mail.Address{ | ||
Name: "Michael Jones", | ||
Address: "[email protected]", | ||
}, | ||
to: []mail.Address{ | ||
{ | ||
Name: "Mary Smith", | ||
Address: "[email protected]", | ||
}, | ||
}, | ||
messageID: "[email protected]", | ||
date: parseDate("Fri, 21 Nov 1997 09:55:06 -0600"), | ||
htmlBody: "<div dir=\"ltr\">👍</div>", | ||
textBody: "👍", | ||
}, | ||
} | ||
|
||
for index, td := range testData { | ||
|
@@ -946,3 +971,27 @@ Content-Disposition: attachment; | |
--f403045f1dcc043a44054c8e6bbf-- | ||
` | ||
|
||
var base64Content = `MIME-Version: 1.0 | ||
From: John Doe <[email protected]> | ||
Sender: Michael Jones <[email protected]> | ||
To: Mary Smith <[email protected]> | ||
Subject: Saying Hello | ||
Date: Fri, 21 Nov 1997 09:55:06 -0600 | ||
Message-ID: <[email protected]> | ||
Content-Type: multipart/alternative; boundary="000000000000ab2e1f05a26de586" | ||
--000000000000ab2e1f05a26de586 | ||
Content-Type: text/plain; charset="UTF-8" | ||
Content-Transfer-Encoding: base64 | ||
8J+RjQo= | ||
--000000000000ab2e1f05a26de586 | ||
Content-Type: text/html; charset="UTF-8" | ||
Content-Transfer-Encoding: base64 | ||
PGRpdiBkaXI9Imx0ciI+8J+RjTwvZGl2Pgo= | ||
--000000000000ab2e1f05a26de586-- | ||
` |