]> source.dussan.org Git - gitea.git/commitdiff
Allow send mail without authentication if SMTP server allow this
authorAlukardd <alukardd@alukardd.org>
Sun, 7 Dec 2014 13:07:48 +0000 (16:07 +0300)
committerAlukardd <alukardd@alukardd.org>
Sun, 7 Dec 2014 13:07:48 +0000 (16:07 +0300)
modules/mailer/mailer.go

index df3efb610bc2215aef23885de7a5841cc686747d..474e1481cd54b8fc1138a6318cf9e28bc6754419 100644 (file)
@@ -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