'NodeMailer Sending But Recipient Not Receiving
I'm working with NodeMailer trying to figure out why the emails are being sent, but not received. I can see they are being sent because I can see them in my sent folder of my Gmail account. Please let me know what I'm doing wrong.
exports.sendEmail = async(address, subject, html) => {
let transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 587,
auth: {
user: '[email protected]',
pass: process.env.GMAIL_PASSWORD
}
});
let mailOptions = {
subject: subject,
to: address,
html: html,
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
}
Then I call the function here:
await utils.sendEmail(user.email, 'Example Password Reset', '<body><p>Click this link to reset your password: <a href="https://example.app/forgotpassword?code=' + passwordResetCode + '">Password Reset Link</a></p><br><p>Or copy this address into your browser: https://example.app/forgotpassword?code=' + passwordResetCode + '</p></body>');
All the emails look normal in my sent folder, but none of them are received by the recipient. Could it be something weird with having the ".app" at the end of my domain? Or am I just doing something wrong in my code?
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
