diff options
author | Alukardd <alukardd@alukardd.org> | 2014-12-07 16:07:48 +0300 |
---|---|---|
committer | Alukardd <alukardd@alukardd.org> | 2014-12-07 16:07:48 +0300 |
commit | 21081836ba2c408aad04591980f5551a58fdb89d (patch) | |
tree | 5ae66047f6020ea5c0afdbc457d80fa0677ada47 | |
parent | a2f6e1803bb8322843777f1795f8966de81a84c0 (diff) |
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 df3efb61..474e1481 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 |