I am running a server using Nodemailer. Sometimes the api service respond me with 421.
"{"errorCode":421,
"erroText":"Error occurs",
"error":{"code":"EENVELOPE","response":"550 5.1.0 <xxx@xxxxxx.it> Connessione da 100.27.27.90 temporaneamente rifiutata / Connection from 100.27.27.90 temporarily rejected","responseCode":550,"command":"MAIL FROM"}}"
This is my code in node
var transporter = nodemailer.createTransport({
host: "smtps.aruba.it",
logger: true,
debug: true,
secure: true,
port: 465,
auth: {
user: "xxx@xxxxx.it",
pass: "xxxxx",
},
tls: {
minVersion: "TLSv1",
ciphers: "HIGH:MEDIUM:!aNULL:!eNULL:@STRENGTH:!DH:!kEDH",
},
});
let mailOptions = {
from: '"xxx" <xxx@xxx.it>',
to: email,
subject: "Riepilogo prenotazione",
html: `...`,
};
transporter.sendMail(mailOptions, function (err, data) {
if (err) {
res.json({
errorCode: 421,
erroText: "Error occurs",
error: err,
});
} else {
res.json({
errorCode: 200,
status: "Appointment Created!",
});
}
});
transporter.close();
If I make 2 or 3 calls in a row, the service gives me error 421 with this description
The SMTP 550 error being returned to nodemailer is saying that server smtps.aruba.it is temporarily rejecting the programs request to send data. I suspect it's either 1)the smtp server or 2)some conflict with your dev environment and localhost.
I've had the most success with nodemailer in conjunction with an email sandbox like mailtrap, which allowed me to "trap" the outgoing mail from my local dev environment for testing.