I am sending emails using nodemailer
using node.js
and i have this configuration to send emails
var transporter = nodemailer.createTransport({
service: 'gmail',
host: 'smtp.gmail',
auth: {
user: '[email protected]',
pass: 'password'
}
});
const mailOptions = {
from: '[email protected]', // sender address
to: userpany_email, // list of receivers
subject: 'EnStream New Account Signup Password', // Subject line
html: `<p style="font-size : 15px;">Please sing in to your en-stream account here <a href="">;/a> with this password : ${userPassword}</p>`// plain text body
};
It's sending emails on local environment correctly but in production environment on Aws Ec2
it is throwing this error
code: "EAUTH"
mand: "AUTH PLAIN"
response: "534-5.7.14 <;scc=1&plt=AKgnsbua↵534-5.7.14 qup7zOOL4GtmYEf1HEHBASSSBgbuMNJRQqK2v3X9mcxDRX1SrXU2Y_LSqZm7Y7yJvH2PwL↵534-5.7.14 JZW6iSXxsRhBdntFAAamrvitpdKS_YJiE-pEnXWakITAz1PAzwDMxjJPKntQrLl2Qx-xA1↵534-5.7.14 zZ4aTvKvYOAk85YHwABnnd0wHU2HkUeHPoDYqgXUWgSA_8Rrn4xkIsUN> Please log↵534-5.7.14 in via your web browser and then try again.↵534-5.7.14 Learn more at↵534 5.7.14 a11sm34494120wrx.5 - gsmtp"
responseCode: 534
I allowed outbound port 465 in my ec2
instance security group like this
What's the real issue in this?
I am sending emails using nodemailer
using node.js
and i have this configuration to send emails
var transporter = nodemailer.createTransport({
service: 'gmail',
host: 'smtp.gmail.',
auth: {
user: '[email protected]',
pass: 'password'
}
});
const mailOptions = {
from: '[email protected]', // sender address
to: user.pany_email, // list of receivers
subject: 'EnStream New Account Signup Password', // Subject line
html: `<p style="font-size : 15px;">Please sing in to your en-stream account here <a href="http://demo.en-stream./auth/login">http://demo.en-stream./auth/login</a> with this password : ${userPassword}</p>`// plain text body
};
It's sending emails on local environment correctly but in production environment on Aws Ec2
it is throwing this error
code: "EAUTH"
mand: "AUTH PLAIN"
response: "534-5.7.14 <https://accounts.google./signin/continue?sarp=1&scc=1&plt=AKgnsbua↵534-5.7.14 qup7zOOL4GtmYEf1HEHBASSSBgbuMNJRQqK2v3X9mcxDRX1SrXU2Y_LSqZm7Y7yJvH2PwL↵534-5.7.14 JZW6iSXxsRhBdntFAAamrvitpdKS_YJiE-pEnXWakITAz1PAzwDMxjJPKntQrLl2Qx-xA1↵534-5.7.14 zZ4aTvKvYOAk85YHwABnnd0wHU2HkUeHPoDYqgXUWgSA_8Rrn4xkIsUN> Please log↵534-5.7.14 in via your web browser and then try again.↵534-5.7.14 Learn more at↵534 5.7.14 https://support.google./mail/answer/78754 a11sm34494120wrx.5 - gsmtp"
responseCode: 534
I allowed outbound port 465 in my ec2
instance security group like this
What's the real issue in this?
Share Improve this question edited Apr 10, 2019 at 8:26 Fahad Subzwari asked Apr 10, 2019 at 7:15 Fahad SubzwariFahad Subzwari 2,3653 gold badges28 silver badges63 bronze badges 3- Have you checked error troubleshooting steps? – Imran Commented Apr 18, 2019 at 2:39
- Does this help? serverfault./questions/635139/… – 1565986223 Commented Apr 18, 2019 at 16:31
- No. I have done these steps already and on my local machine it's working fine but on aws it's not working – Fahad Subzwari Commented Apr 19, 2019 at 6:10
1 Answer
Reset to default 8 +50You may require permission for this from Gmail.
For which you have to enable the Allow access to your Google Account.
Steps:
- Go to this link through the same browser from which you are trying to Login.
- It will ask "Allow access to your Google Account". Click on "Continue" button.
- The message "Account access enabled" will be displayed.
Also, setting for "Less Secure Apps" must be allowed. Go through this link: https://myaccount.google./lesssecureapps.
If the issue still persists, check if your server IP is blocked by Gmail.
This should help!