I have a Mern Stack blog application implementing with Signup and login validation. For sending OTP I use a SMTP service nodemailer. It sends mails perfectly in local. I just want to know will it work after deploying on Netlify because Vercel does not allow Nodemailer to send Email. Is this the same case with Netlify ?
Hi @Rakesh99, thanks for the post and welcome.
Since you indicated that your application is a MERN application, if you are planning to deploy to Netlify there are two things you should consider even though Nodemailer will work when you deploy to Netlify.
-
First of all since you mentioned vercel, if you want to deploy a Next.js application on Netlify, your api routes or server side rendered (SSR) pages will run on Netlify Functions under the hood, and thus, are subject to the Netlify Function limitations especially 10 seconds execution timeout.
Nodemailer will work provided your code logic does not exceed 10 seconds.
You can learn more at Netlify Functions -
Secondly if your application frontend is separate from the backend and you want to deploy the Express.js backend API on Netlify.
Again the Express.js backend API will have to be deployed as Netlify Functions.
The same execution limit of 10 seconds still applies.
Note that the functions execution timeout can be increased, however you’ll need to be on the Pro tier for that change to be made.
That’s a requirement that applies to everyone who wants a larger timeout. You can upgrade to Pro easily through the Netlify UI dashboard.
If you contact support when you have upgraded, They can change the settings for you!
Hope the above explanation helps.
Thanks.