1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

add error when no authentication is configured

This commit is contained in:
Soner Sayakci 2022-03-04 17:03:04 +01:00
parent f15efcd6f2
commit ed6e51b4df

View File

@ -49,6 +49,11 @@ func (s *SMTPSendingService) Send(mail *models.Mail) error {
if ok, _ := c.Extension("AUTH"); !ok { if ok, _ := c.Extension("AUTH"); !ok {
return errors.New("smtp: server doesn't support AUTH") return errors.New("smtp: server doesn't support AUTH")
} }
if len(s.config.Username) == 0 || len(s.config.Password) == 0 {
return errors.New("smtp: server requires authentification, but no authentification is provided")
}
if err = c.Auth(s.auth); err != nil { if err = c.Auth(s.auth); err != nil {
return err return err
} }