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.
use decodeContent on every part, NextRawPart for mime types (manual m…
…erge of arkagpl:master DusanKasan#28 and matoubidou:master DusanKasan#26)
- Loading branch information
Showing
2 changed files
with
105 additions
and
30 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 |
---|---|---|
|
@@ -372,15 +372,15 @@ So, "Hello".`, | |
htmlBody: "<div dir=\"ltr\"><br></div>", | ||
attachments: []attachmentData{ | ||
{ | ||
filename: "unencoded.csv", | ||
contentType: "application/csv", | ||
data: fmt.Sprintf("\n"+`"%s", "%s", "%s", "%s", "%s"`+"\n"+`"%s", "%s", "%s", "%s", "%s"`+"\n", "Some", "Data", "In", "Csv", "Format", "Foo", "Bar", "Baz", "Bum", "Poo"), | ||
filename: "unencoded.csv", | ||
contentType: "application/csv", | ||
data: fmt.Sprintf("\n"+`"%s", "%s", "%s", "%s", "%s"`+"\n"+`"%s", "%s", "%s", "%s", "%s"`+"\n", "Some", "Data", "In", "Csv", "Format", "Foo", "Bar", "Baz", "Bum", "Poo"), | ||
}, | ||
}, | ||
}, | ||
13: { | ||
contentType: "multipart/related; boundary=\"000000000000ab2e2205a26de587\"", | ||
mailData: multipartRelatedExample, | ||
mailData: multipartRelatedExample, | ||
subject: "Saying Hello", | ||
from: []mail.Address{ | ||
{ | ||
|
@@ -389,7 +389,7 @@ So, "Hello".`, | |
}, | ||
}, | ||
sender: mail.Address{ | ||
Name: "Michael Jones", | ||
Name: "Michael Jones", | ||
Address: "[email protected]", | ||
}, | ||
to: []mail.Address{ | ||
|
@@ -401,7 +401,7 @@ So, "Hello".`, | |
messageID: "[email protected]", | ||
date: parseDate("Fri, 21 Nov 1997 09:55:06 -0600"), | ||
htmlBody: "<div dir=\"ltr\"><div>Time for the egg.</div><div><br></div><div><br><br></div></div>", | ||
textBody: "Time for the egg.", | ||
textBody: "Time for the egg.", | ||
}, | ||
14: { | ||
mailData: data3, | ||
|
@@ -563,10 +563,14 @@ So, "Hello".`, | |
t.Error(err) | ||
} | ||
|
||
if ra.Filename == ad.filename && string(b) == ad.data && ra.ContentType == ad.contentType { | ||
if ra.Filename == ad.filename && ra.ContentType == ad.contentType { | ||
found = true | ||
attachs = append(attachs[:i], attachs[i+1:]...) | ||
} | ||
|
||
if string(b) != ad.data { | ||
t.Errorf("[Test Case %v] Bad data for attachment: \nEXPECTED:\n%s\nHAVE:\n%s", index, ad.data, string(b)) | ||
} | ||
} | ||
|
||
if !found { | ||
|
@@ -623,9 +627,9 @@ func parseDate(in string) time.Time { | |
} | ||
|
||
type attachmentData struct { | ||
filename string | ||
contentType string | ||
data string | ||
filename string | ||
contentType string | ||
data string | ||
} | ||
|
||
type embeddedFileData struct { | ||
|
@@ -869,8 +873,8 @@ Message-ID: <[email protected]> | |
Hi everyone. | ||
` | ||
|
||
//todo: not yet implemented in net/mail | ||
//once there is support for this, add it | ||
// todo: not yet implemented in net/mail | ||
// once there is support for this, add it | ||
var rfc5322exampleA13 = `From: Pete <[email protected]> | ||
To: A Group:Ed Jones <[email protected]>,[email protected],John <[email protected]>; | ||
Cc: Undisclosed recipients:; | ||
|
@@ -880,7 +884,7 @@ Message-ID: <[email protected]> | |
Testing. | ||
` | ||
|
||
//we skipped the first message bcause it's the same as A 1.1 | ||
// we skipped the first message bcause it's the same as A 1.1 | ||
var rfc5322exampleA2a = `From: Mary Smith <[email protected]> | ||
To: John Doe <[email protected]> | ||
Reply-To: "Mary Smith: Personal Account" <[email protected]> | ||
|