Per https://github.com/nodemailer/nodemailer/issues/889#issuecomment-488267379 (and it's follow-ups):
same problem here. resolved it by using IP address as host, see
https://nodemailer.com/smtp/#general-options
For us it seems to be related to throttling as circa 140 messages go through in a batch while the remainder get this error (and all are being sent to the same email address, so no issue re: bad email addresses). Changing to an IP didn't solve the issue (maybe because the SMTP is on AWS?).
What did eventually work for us was this - https://stackoverflow.com/a/55187729/235704
The below code change fixed the issue. Added this to the
createTransport()
tls: {rejectUnauthorized: false}
Code:-
// create reusable transporter object using the default SMTP transport
let transporter = nodemailer.createTransport({
host: 'host',
port: 25,
secure : false, // true for 465, false for other ports
auth: {
user: 'user',
pass: 'password'
},
tls: {
// do not fail on invalid certs
rejectUnauthorized: false
},
});
It seems that, in our providers case, their certificates do not cover all of the IPs they are being served from on AWS.