Open maxiride opened 4 years ago
I have a very similar setting to yours, except for the smtp port I'm using 25 and point it to an Exchange server. getting exactly the same issue when I'm trying to do smtp.PlainAuth
The server I'm using supports only AUTH LOGIN extension (you can check ehlo
) and it might be reason in my case.
What AUTH types does your server support? Based on this, seems like no auth is supported but I might be missing something:
telnet smtp-mail.outlook.com 25
Trying 52.98.0.194...
Connected to syd-efz.ms-acdc.office.com.
Escape character is '^]'.
220 SYBPR01CA0043.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 20 Aug 2020 00:16:49 +0000
ehlo smtp-mail.outlook.com
250-SYBPR01CA0043.outlook.office365.com Hello [203.87.114.82]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
AUTH LOGIN
504 5.7.4 Unrecognized authentication type [SYBPR01CA0043.ausprd01.prod.outlook.com]
AUTH PLAIN
504 5.7.4 Unrecognized authentication type [SYBPR01CA0043.ausprd01.prod.outlook.com]
Just realized that this package doesn't support AUTH LOGIN just yet. It's not hard to implement and there's an open PR for it here but it's not merged yet: https://github.com/jordan-wright/email/issues/104
I'd like to get @jordan-wright to have a look. Whoever uses Outlook / Exchange Server will have this issue
it's working for me. https://github.com/go-gomail/gomail/issues/16#issuecomment-73672398
e := email.NewEmail()
addr := "smtp.office365.com:587"
auth := LoginAuth(username, password)
tlsConfig := &tls.Config{
ServerName: "smtp.office365.com",
}
e.SendWithStartTLS(addr, auth, tlsConfig)
I've tried to run the example in the README using the outlook smtp servers:
However the package doesn't send the email and throws the error:
Snippet of MWE:
Upon further research https://github.com/go-gomail/gomail/issues/16 might be related but I'm still digging.