From 74f94c0f269a90288aaa0395d640f3a288c54b2c Mon Sep 17 00:00:00 2001 From: Alexandre Cesaro Date: Tue, 17 Mar 2015 15:40:16 +0100 Subject: [PATCH] Improved memory consumption Closes #25 --- mailer.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mailer.go b/mailer.go index 09882d4..99ab619 100644 --- a/mailer.go +++ b/mailer.go @@ -129,11 +129,17 @@ func flattenHeader(msg *mail.Message, bcc string) []byte { for field, value := range msg.Header { 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 != "" { for _, to := range value { if strings.Contains(to, bcc) { - buf.WriteString(field + ": " + to + "\r\n") + buf.WriteString(field) + buf.WriteString(": ") + buf.WriteString(to) + buf.WriteString("\r\n") } } }