summaryrefslogtreecommitdiffstats
path: root/modules/mailer
diff options
context:
space:
mode:
authorAlukardd <alukardd@alukardd.org>2014-12-07 16:07:48 +0300
committerAlukardd <alukardd@alukardd.org>2014-12-07 16:07:48 +0300
commit21081836ba2c408aad04591980f5551a58fdb89d (patch)
tree5ae66047f6020ea5c0afdbc457d80fa0677ada47 /modules/mailer
parenta2f6e1803bb8322843777f1795f8966de81a84c0 (diff)
downloadgitea-21081836ba2c408aad04591980f5551a58fdb89d.tar.gz
gitea-21081836ba2c408aad04591980f5551a58fdb89d.zip
Allow send mail without authentication if SMTP server allow this
Diffstat (limited to 'modules/mailer')
-rw-r--r--modules/mailer/mailer.go5
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