I've had a mailer working fine in my NodeJS app on both production and developement servers. Now it suddenly gives me this error on production, but still works fine on the developement server. They both use the same mailer with the same settings yet the error says the settings are incorrect on production. It's hosted on Orangehost and again, it was working fine before.
"status": "500",
"code": "EAUTH",
"message": "Invalid login: 535 Incorrect authentication data",
"stack": "Error: Invalid login: 535 Incorrect authentication data\n at SMTPConnection._formatError (/home/r4xdes/nodevenv/r4xdesignsnodejs/18/lib/node_modules/nodemailer/lib/smtp-connection/index.js:807:19)\n at SMTPConnection._actionAUTHComplete (/home/r4xdes/nodevenv/r4xdesignsnodejs/18/lib/node_modules/nodemailer/lib/smtp-connection/index.js:1586:34)\n at SMTPConnection.<anonymous> (/home/r4xdes/nodevenv/r4xdesignsnodejs/18/lib/node_modules/nodemailer/lib/smtp-connection/index.js:554:26)\n at SMTPConnection._processResponse (/home/r4xdes/nodevenv/r4xdesignsnodejs/18/lib/node_modules/nodemailer/lib/smtp-connection/index.js:991:20)\n at SMTPConnection._onData (/home/r4xdes/nodevenv/r4xdesignsnodejs/18/lib/node_modules/nodemailer/lib/smtp-connection/index.js:772:14)\n at SMTPConnection._onSocketData (/home/r4xdes/nodevenv/r4xdesignsnodejs/18/lib/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)\n at TLSSocket.emit (node:events:517:28)\n at addChunk (node:internal/streams/readable:368:12)\n at readableAddChunk (node:internal/streams/readable:341:9)\n at Readable.push (node:internal/streams/readable:278:10)"
The error message indicates that the SMTP server rejected the authentication credentials, which is likely due to incorrect username or password, or due to specific security settings of the email provider. Here are some steps to troubleshoot this issue:
Verify Credentials: Double-check the email and password you’re using in the SMTP configuration. If using environment variables, ensure they’re correctly set.
Enable Less Secure App Access: If you’re using Gmail or similar email providers, check if the “Allow less secure app access” setting is enabled in your email account’s security settings. This setting is often required for third-party applications to connect.
Enable Two-Factor Authentication: If two-factor authentication (2FA) is enabled on the email account, you might need to create an "app-specific password" instead of using the usual account password.
Use the Correct Port and Encryption: Verify that the SMTP settings (such as port, secure flag, and host) match the email provider's recommendations. Common ports are 587 (for TLS) and 465 (for SSL).
Check IP or Firewall Restrictions: Some providers block certain IP addresses or may have restrictions if too many failed login attempts were made. Consider reaching out to your provider’s support if these steps don’t resolve the issue.
If you’re still having trouble, sharing the relevant part of your SMTP configuration code (excluding sensitive information) could help diagnose the problem further.
I don't know if it's a node issue or not as I don't use Node (yet). But I find I always have better luck with the mailer if I have it set to 'Server Default' rather than 'SMTP'.
Yes, but the same exact credentials work fine on my development server, email goes out no problem, but when I upload everything to the production server, I get that error. That's what's so frustrating.
Yea I may try something like that. Right now, I'm trying to rewrite the app to allow guest checkout cause it's my wife's craft website and she has a market tomorrow where she will be showcasing the site. Isn't that always the case, major bug right when you don't need it.....sigh
Thanks for all the replies so far guys. Much appreciated. Stressing over here.
Interesting .... you may have come across something. I also host with Orangehost and my PHP site mails no problem. However I set up a test on my Node project and get 500 errors using the same settings.
It's weird that it just started though. I have access to another node compatible server with a client of mine. I may upload it there and test when I get a chance. Right now, too much of a time crunch.
I have a new app password and that works on local/development server. But no luck with it on production orangehost. I was using binding for the host, port, username and password so I just hardcoded them on production and still same error. Urgh. really apprecate the helps guys, thanks so much.