소스 검색

Merge pull request #720 from Alukardd/dev

Allow send mail without authentication if SMTP server allow this
无闻 10 년 전
부모
커밋
2844674587
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      modules/mailer/mailer.go

+ 4 - 1
modules/mailer/mailer.go

@@ -127,7 +127,10 @@ func Send(msg *Message) (int, error) {
 		return 0, fmt.Errorf("empty email body")
 		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 {
 	if msg.Massive {
 		// send mail to multiple emails one by one
 		// send mail to multiple emails one by one