I am EC2 instance up and running , I wanted to integrate nodemailer in my application. Following the https://www.npmjs.com/package/nodemailer I was able to send email from my localhost. When the same code I integrated on EC2
instance I am getting Invalid login error
. Sometime gmail blocks login from other application and send confirm mail to the inbox. I didnt get any such mail also. Do I need to enable some port on EC2
instance or I can use nodemailer
at all on EC2 instance. Please suggest
Asked
Active
Viewed 6,252 times
6

Sharanabasu Angadi
- 4,304
- 8
- 43
- 67
-
[Previous question and I had the same problem, it's turning on access to less secure apps][1] [1]: http://serverfault.com/questions/635139/how-to-fix-send-mail-authorization-failed-534-5-7-14 – user3486758 Sep 16 '15 at 05:04
2 Answers
2
No need to enable aws ses service
Open port : 465 on aws(e2c) instance in outbound section.
Test if port really opened : with nmap command nmap 14.247.74.33
.
Note : do not proceed until you see open ports like
Starting Nmap 5.21 ( http://nmap.org ) at 2012-08-15 19:01 IST
Nmap scan report for 14.247.74.33
Host is up (0.058s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
23/tcp open telnet
80/tcp open http
465 open
Simple nodemailer configuration works
const transporter = nodemailer.createTransport({
service: 'gmail',
host: 'smtp.gmail.com',
port: 465,
secure: true,
auth: {
user: EMAIL_ID,
pass: EMAIL_PASSOWRD,
},
});

vijay
- 10,276
- 11
- 64
- 79
-
Well, still this configuration gives `QueryReqWrap.onresolve [as oncomplete] (dns.js:213:19)` error. – zygimantus Jan 07 '20 at 11:05
1
Gmail is not a production SMTP service. Configure nodemailer to send mail from a production mailer, such as AWS Simple Email Service. Like gmail, SES is a "well-known service" in nodemailer. There's a great example of using SES in the nodemailer README.

tedder42
- 23,519
- 13
- 86
- 102