Skip to content

Commit 3f6c3c2

Browse files
authoredMar 5, 2025··
Merge pull request #758 from Darneus/master
allow smtp with no auth
2 parents d37f25e + ded8d2b commit 3f6c3c2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

‎services/mail/smtp.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ func (s *SMTPSendingService) Send(mail *models.Mail) error {
6565
defer c.Close()
6666
}
6767

68-
if s.auth != nil {
69-
if ok, _ := c.Extension("AUTH"); !ok {
70-
return errors.New("smtp: server doesn't support AUTH")
71-
}
72-
68+
// authenticate if required
69+
if ok, _ := c.Extension("AUTH"); ok && s.auth != nil {
7370
if len(s.config.Username) == 0 || len(s.config.Password) == 0 {
7471
return errors.New("smtp: server requires authentication, but no authentication is provided")
7572
}

0 commit comments

Comments
 (0)
Please sign in to comment.