Unable to send mails with Nodemailer from Vercel deployment
Unanswered
Pacific anchoveta posted this in #help-forum
Pacific anchovetaOP
I've set up a contact form and use Nodemailer to send emails through the
The only documentation I've found at Vercel is this:
https://vercel.com/guides/sending-emails-from-an-application-on-vercel
I can't (and do not want) to use a thrid party service for this, but for me at least it seems like they say it's possible to do this "on your own", using Nodemailer. The one thing I'm a bit confused about in the docs above is this statement here:
When doing so, we recommend using an external host value provided by a third-party provider, rather than defaulting to the outbound SMTP connection of the Serverless Function.
How do I know if I'm "...defaulting to the outbound SMTP connection of the Serverless Function." ?
My current
Anyone that could help me out here? All help and tips are highly appreciated.
app/api
directory. It works smoothly in dev and when I test the build locally, but the Vercel deployment won't send any mails. I've looked through the interwebs and found more people having the same issue, but no solution yet. I know the code is working, as I've even set up a transport.verify()
function in the file that logs success in the vercel deployment log (see image). The only documentation I've found at Vercel is this:
https://vercel.com/guides/sending-emails-from-an-application-on-vercel
I can't (and do not want) to use a thrid party service for this, but for me at least it seems like they say it's possible to do this "on your own", using Nodemailer. The one thing I'm a bit confused about in the docs above is this statement here:
When doing so, we recommend using an external host value provided by a third-party provider, rather than defaulting to the outbound SMTP connection of the Serverless Function.
How do I know if I'm "...defaulting to the outbound SMTP connection of the Serverless Function." ?
My current
route.ts
code is in the other image, and as mentioned works fine in dev.Anyone that could help me out here? All help and tips are highly appreciated.
19 Replies
Asian black bear
Their upstream provider Amazon AWS is extremely restrictive about outgoing traffic on port 25
(also 587, and 465)
The typical workaround is to connect to a mail exchanger you control that runs on a non-standard port, or use AWS SES
Pacific anchovetaOP
Oh, really. Thanks for the advice, I apprciate it
So, could I simply change 465 to 466?
Asian black bear
it has been a while, but yeah that should work
unless it is also a "standard" email port
be warned, running your own MX in EC2 is also not going to work
Trying to forward/route/mangle traffic to an email port in EC2 will definitely not work
Pacific anchovetaOP
No, I can see from Nodemailer docs that is is just 465 or 587
Asian black bear
yeah, that makes sense
Pacific anchovetaOP
very disappointing, indeed
Asian black bear
To be fair, getting your IPs/resources SPAM blacklisted is almost impossible to deal with, and it spills to trust even on other non-email services
Pacific anchovetaOP
so basically I can't be done, unless I use some third party provider then? I tried to sign up for 'SendGrid', as I was just about to give up on it, an they have a 'technical' problem as well it seems, so I can't sign up even
Asian black bear
Just use SES, it is fantastic
Pacific anchovetaOP
ok ill check it out, thank you
Asian black bear
the free tier might even work for 62,000 free emails per month since Vercel runs on Lambda, which kind of tangentially runs on something adjacent to EC2