This error occurs when Nodemailer cannot successfully authenticate with the SMTP server using the credentials provided. It results from invalid credentials, SMTP host, port, and even a misconfigured SMTP authentication for the sender account.
You can try the following actions to resolve the error.
1. Verify SMTP credentials
Verify that the username, password, SMTP hostname, SMTP port, and protocol (SSL/TLS) are configured correctly with valid information. You can use the boilerplate configuration code shown below and replace the values with your SMTP information.
1 2 3 4 5 6 7 8 9
let transporter = nodemailer.createTransport({ host: 'YOUR-SMTP-HOST', secure: <<true>> or <<false>> based on your provider, port: 465 or 587 based on the use of SSL or TLS, auth: { user: 'YOUR-EMAIL-ADDRESS', pass: 'ZOHO-APPLICATION-PASSWORD, }, });
2. Use app passwords
For certain SMTP providers, such as Zoho, you will likely run into this error if you are trying to authenticate to an account with two-factor authentication using a password. In such situations, you must generate a specific application password and use the generated password in the Nodemail configurations.
1 2 3 4 5 6 7 8 9
let transporter = nodemailer.createTransport({ host: 'smtp.zoho.com', secure: true, port: 465, auth: { user: 'YOUR-EMAIL-ADDRESS', pass: 'ZOHO-APPLICATION-PASSWORD, }, });
3. Enable Less Secure Application Access
For SMTP servers such as Google, you must enable "Less Secure Application Access" to allow authentication with Nodemailer.
4. Disable firewall/anti-virus guards
You can try disabling your firewall or anti-virus guard and re-connecting. It may help solve your error.
View all errors
Send up to 10,000 notifications every month, for free.
Get started for free
Send up to 10,000 notifications every month, for free.
Get started for free
© 2024 Courier. All rights reserved.