Improved memory consumption

Closes #25
This commit is contained in:
Alexandre Cesaro 2015-03-17 15:40:16 +01:00
parent 19744cb73d
commit 74f94c0f26
1 changed files with 8 additions and 2 deletions

View File

@ -129,11 +129,17 @@ func flattenHeader(msg *mail.Message, bcc string) []byte {
for field, value := range msg.Header { for field, value := range msg.Header {
if field != "Bcc" { if field != "Bcc" {
buf.WriteString(field + ": " + strings.Join(value, ", ") + "\r\n") buf.WriteString(field)
buf.WriteString(": ")
buf.WriteString(strings.Join(value, ", "))
buf.WriteString("\r\n")
} else if bcc != "" { } else if bcc != "" {
for _, to := range value { for _, to := range value {
if strings.Contains(to, bcc) { if strings.Contains(to, bcc) {
buf.WriteString(field + ": " + to + "\r\n") buf.WriteString(field)
buf.WriteString(": ")
buf.WriteString(to)
buf.WriteString("\r\n")
} }
} }
} }