diff options
author | Daniel Schalla <daniel@schalla.me> | 2018-09-03 14:08:40 +0200 |
---|---|---|
committer | Jesús Espino <jespinog@gmail.com> | 2018-09-03 14:08:40 +0200 |
commit | 531897b1f0d8176c1f983f921f1d1de618db0131 (patch) | |
tree | 0f01811eee640141b6a1959ed64a7b250fd59d47 /utils/mail.go | |
parent | 68fdaaa995555e93f067efc3a07f1866e43ae665 (diff) | |
download | chat-531897b1f0d8176c1f983f921f1d1de618db0131.tar.gz chat-531897b1f0d8176c1f983f921f1d1de618db0131.tar.bz2 chat-531897b1f0d8176c1f983f921f1d1de618db0131.zip |
add megacheck as makefile target (#9288)
Fix code issues in channel_test.go
Fix Channel Test Issues detected by Megacheck
Fix API Emoji Test Issues detected by Megacheck
Fixed API Issues Reported by Megacheck
Fixed App issues reported by megacheck
Remaining fixes
removed test added by mistake from old HEAD
gofmt
Store Fixes
simplified returns
Fix test for multi member channel delete
revert to delete unused function
Diffstat (limited to 'utils/mail.go')
-rw-r--r-- | utils/mail.go | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/utils/mail.go b/utils/mail.go index 7b0cb3588..750cb64fe 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -257,20 +257,18 @@ func SendMail(c *smtp.Client, mimeTo, smtpTo string, from mail.Address, subject, m.SetBody("text/plain", txtBody) m.AddAlternative("text/html", htmlMessage) - if attachments != nil { - for _, fileInfo := range attachments { - bytes, err := fileBackend.ReadFile(fileInfo.Path) - if err != nil { - return err - } - - m.Attach(fileInfo.Name, gomail.SetCopyFunc(func(writer io.Writer) error { - if _, err := writer.Write(bytes); err != nil { - return model.NewAppError("SendMail", "utils.mail.sendMail.attachments.write_error", nil, err.Error(), http.StatusInternalServerError) - } - return nil - })) + for _, fileInfo := range attachments { + bytes, err := fileBackend.ReadFile(fileInfo.Path) + if err != nil { + return err } + + m.Attach(fileInfo.Name, gomail.SetCopyFunc(func(writer io.Writer) error { + if _, err := writer.Write(bytes); err != nil { + return model.NewAppError("SendMail", "utils.mail.sendMail.attachments.write_error", nil, err.Error(), http.StatusInternalServerError) + } + return nil + })) } if err := c.Mail(from.Address); err != nil { |