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

fix: ignore error "starttls command has been already sent"

This commit is contained in:
xiecang 2022-11-16 12:29:20 +08:00
parent 94e0d06e5d
commit ae407fffca

View File

@ -42,9 +42,14 @@ func (s *SMTPSendingService) Send(mail *models.Mail) error {
if ok, _ := c.Extension("STARTTLS"); ok { if ok, _ := c.Extension("STARTTLS"); ok {
if err = c.StartTLS(nil); err != nil { if err = c.StartTLS(nil); err != nil {
errCode := err.(*smtp.SMTPError).Code
if errCode == 503 {
// TLS already active
} else {
return err return err
} }
} }
}
if s.auth != nil { if s.auth != nil {
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")