diff options
author | 无闻 <joe2010xtmf@163.com> | 2014-12-07 16:05:55 -0500 |
---|---|---|
committer | 无闻 <joe2010xtmf@163.com> | 2014-12-07 16:05:55 -0500 |
commit | 2844674587f87af676e7b5b8899551472cc677f3 (patch) | |
tree | 39e064456d6751664782fb64f92ff107bd277741 | |
parent | 0daef29053ac112e9cd86dc8fac7b78f4f38d387 (diff) | |
parent | 21081836ba2c408aad04591980f5551a58fdb89d (diff) | |
download | gitea-2844674587f87af676e7b5b8899551472cc677f3.tar.gz gitea-2844674587f87af676e7b5b8899551472cc677f3.zip |
Merge pull request #720 from Alukardd/dev
Allow send mail without authentication if SMTP server allow this
-rw-r--r-- | modules/mailer/mailer.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go index df3efb610b..474e1481cd 100644 --- a/modules/mailer/mailer.go +++ b/modules/mailer/mailer.go @@ -127,7 +127,10 @@ func Send(msg *Message) (int, error) { return 0, fmt.Errorf("empty email body") } - auth := smtp.PlainAuth("", setting.MailService.User, setting.MailService.Passwd, host[0]) + var auth smtp.Auth + if len(setting.MailService.Passwd) > 0 { + auth = smtp.PlainAuth("", setting.MailService.User, setting.MailService.Passwd, host[0]) + } if msg.Massive { // send mail to multiple emails one by one |