summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorPeter <peter@smitmail.eu>2014-12-19 23:06:03 +0200
committerPeter <peter@smitmail.eu>2014-12-19 23:06:03 +0200
commitc884ecfea18b001ceb9cdbe98c8618a345f460e0 (patch)
tree034ab960c7982e117b68e29797d17374f0105a16 /modules
parentedbe1de026cbc6d138a4382a3207c9f4f8280193 (diff)
downloadgitea-c884ecfea18b001ceb9cdbe98c8618a345f460e0.tar.gz
gitea-c884ecfea18b001ceb9cdbe98c8618a345f460e0.zip
Parse the from string to extract the email address
Diffstat (limited to 'modules')
-rw-r--r--modules/mailer/mailer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go
index 3ce14822f7..fd10c1e5a9 100644
--- a/modules/mailer/mailer.go
+++ b/modules/mailer/mailer.go
@@ -8,6 +8,7 @@ import (
"crypto/tls"
"fmt"
"net"
+ "net/mail"
"net/smtp"
"strings"
@@ -124,8 +125,12 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte)
}
}
- if err = client.Mail(settings.From); err != nil {
+ if fromAddress, err := mail.ParseAddress(settings.From); err != nil {
return err
+ } else {
+ if err = client.Mail(fromAddress.Address); err != nil {
+ return err
+ }
}
for _, rec := range recipients {