I'm trying to use Nodemailer with Firebase cloud functions and I'm using AWS Simple Email Sender as my SMTP service. Nodemailer works perfectly in my localhost with AWS Simple Email Sender but when I deploy it to Firebase Cloud Functions I got this error:
{ Error: queryA EREFUSED email-smtp.us-east-1.amazonaws.com
at QueryReqWrap.onresolve [as oncomplete] (dns.js:213:19)
errno: 'EREFUSED',
code: 'EDNS',
syscall: 'queryA',
hostname: 'email-smtp.us-east-1.amazonaws.com',
command: 'CONN' }
I'm using the example that is on the web page and my credentials for AWS SES are okay but I don't know what this error means. I tried to change the port but still not working.
const nodemailer = require('nodemailer');
async function main() {
let transporter = nodemailer.createTransport({
host: 'email-smtp.us-east-1.amazonaws.com',
port: 465,
secure: true,
auth: {
user: '[email protected]',
pass: 'thisisfake'
}
});
let info = await transporter.sendMail({
from: '"Fred Foo 👻" <[email protected]>',
to: '[email protected], [email protected]',
subject: 'Hello ✔', // Subject line
text: 'Hello world?', // plain text body
html: '<b>Hello world?</b>' // html body
});
console.log('Message sent: %s', info.messageId);
console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
}
main().catch(console.error);
Same here, anyone to help out?
I had same problem using netsons
I found the problem. It was because I had the free plan on firebase. I switched to the blaze plan (paid plan) and it worked. So the problem was that firebase was blocking SES from amazon web services because It is a third party service and you need to have the blaze plan in order to use third party services
Since I'm still in development and don't want to pay for a Blaze plan yet, the other option is to use a Gmail account (I set one up just for testing) with a debug flag to handle the different configurations. This seems to work. Just remember to turn on less secure apps option in the Gmail account or Google will yell at you because it doesn't like "robots" authenticating with just an email and password.
Most helpful comment
I found the problem. It was because I had the free plan on firebase. I switched to the blaze plan (paid plan) and it worked. So the problem was that firebase was blocking SES from amazon web services because It is a third party service and you need to have the blaze plan in order to use third party services