Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

504 5.7.4 Unrecognized authentication type #113

Open
maxiride opened this issue May 19, 2020 · 3 comments
Open

504 5.7.4 Unrecognized authentication type #113

maxiride opened this issue May 19, 2020 · 3 comments

Comments

@maxiride
Copy link

maxiride commented May 19, 2020

I've tried to run the example in the README using the outlook smtp servers:

  • SMTP_SERVER=smtp-mail.outlook.com
  • SMTP_PORT=587

However the package doesn't send the email and throws the error:

panic: 504 5.7.4 Unrecognized authentication type [ZR0P278CA0037.CHEP278.PROD.OUTLOOK.COM]

Snippet of MWE:

func send(text, html []byte) {

	m := &email.Email{
		From:    "myself",
		To:      []string{"[email protected]"}, // redacted
		Subject: "Test emails",
		Text:    text,
		HTML:    html,
		Sender:  "[email protected]", // redacted
	}

	mailServer := os.Getenv("SMTP_SERVER") + ":" + os.Getenv("SMTP_PORT")
        // outputs smtp-mail.outlook.com:587

	auth := smtp.PlainAuth("", os.Getenv("SMTP_USERNAME"), os.Getenv("SMTP_PASSWORD"), os.Getenv("SMTP_SERVER"))
       // SMT_SERVER is smtp-mail.outlook.com

	err := m.Send(mailServer, auth)
	if err != nil {
		panic(err)
	}
}

Upon further research go-gomail/gomail#16 might be related but I'm still digging.

@bfarayev
Copy link

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]

@bfarayev
Copy link

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: #104

I'd like to get @jordan-wright to have a look. Whoever uses Outlook / Exchange Server will have this issue

@cuiko
Copy link

cuiko commented Aug 24, 2021

it's working for me.
go-gomail/gomail#16 (comment)

e := email.NewEmail()
addr := "smtp.office365.com:587"
auth := LoginAuth(username, password)
tlsConfig := &tls.Config{
  ServerName: "smtp.office365.com",
}
e.SendWithStartTLS(addr, auth, tlsConfig)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants