Answer the question
In order to leave comments, you need to log in
Why does nodemailer send mail twice?
For some reason, the email is sent twice.
smtpTransport.sendMail(mailOptions, function(error, response) {
if(error) {
res.status(500).json({
message: 'Message not send. We have issues on our server.'
})
}
else {
if (response.accepted.length !== 0) {
res.status(200).json({
message: 'Your message sent!'
})
}
}
})
Answer the question
In order to leave comments, you need to log in
1. Check if one POST is actually sent from the user
2. Is your route really connecting in one place? To check, do a console.log('any') before sending, maybe your application logic calls the send code twice
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question