Reputation: 470
I have set up SMTP server with gmail account. It was working fine till few days back. When I checked the logs I found below entry in it:
SMTP Error: 454 4.7.0 Too many login attempts, please try again later.
I have restarted SMTP service twice. I have checked the configuration that was set up using this link. Everything is same as we have set up. I have restarted the SMTP server & the machine too.
I have checked for 2 step verification settings. It is not enabled. I have checked for "less secure" apps settings and it is set to Enabled as suggested here.
I have checked apps enabled as suggested here using below link.
https://security.google.com/settings/security/permissions?pli=1
But no apps are added. Can anyone suggest anything that I need to look for? Thanks in advance.
Upvotes: 20
Views: 68775
Reputation: 123
It worked for me only when I moved the pool key-value to the top of the object.
const transporter = nodemailer.createTransport({
pool: true,
host: "smtp.gmail.com",
port: 465,
secure: true,
maxConnections: 11,
maxMessages: Infinity,
auth: {
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASS
}
});
Upvotes: 1
Reputation: 169
It may be because the mail's size is greater than the allowed size (25MB).
Upvotes: 1
Reputation: 28665
I had the same issue. When I checked the Mail queue there were many unprocessed mails in the queue. So I deleted the bulk mails and restarted the instance. Once the Mail Queue is cleared then it started to send mails as usual.
Hope this will be useful for anybody to have the above issue.
Upvotes: 2
Reputation: 339
It is because you are attempting to create a new smtp connection for each email. You need to use SMTP pool.
Please see:
Pooled smtp is mostly useful when you have a large number of messages that you want to send in batches or your provider allows you to only use a small amount of parallel connections.
If you are using Node-mailer:
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 465,
secure: true,
pool: true, // This is the field you need to add
auth: {
user: '[email protected]',
pass: 'your_password'
}});
Then, you need to close the pool once you send all the emails.
transporter.close();
Upvotes: 22
Reputation: 7120
please follow the instructions below:
Open Gmail from a browser and only sign into the account you're trying to add. Be sure to be signed out of all your other accounts
Go to this link: https://accounts.google.com/b/0/displayunlockcaptcha and click Continue or confirm.
Now Test your program it will work fine
Upvotes: 0
Reputation: 470
The Issue resolved with the TCP port changing to 587 from 25 in Outbound Connections settings in SMTP Server.
Upvotes: 1