Nodemailer doens't work on production

Hello guys,

I use nodemailer for 2 years in my netlify project without any problems, so I don’t expect any problems in the code.

My provider was sold to a bigger company and nodemailer stopped working.
The problem was obvious, a change in the SMTP hostname. So only I had to do was change the SMTP hostname in the env variables.

Done, locally fixed, mails coming, but on production not, all responses are 502.

X-Nf-Request-Id: 01H2G6SJZMYWY90HT1QQ78QG2K

Any ideas?

How to reproudce the issue? Did you cvheck your function logs when this happend? It’s just stored for 24 hours, so I can’t see the issue now.

my problem was in EP url to call functions.

two years it worked with api/[function-name]

and now it is .netlify/[function-name]


re: Netlify App

Our nodemailer recently started failing in our lambda function for us as well.

Here’s the error:
[Error: 140395438671808:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:…/deps/openssl/openssl/ssl/record/ssl3_record.c:331:
] {
library: ‘SSL routines’,
function: ‘ssl3_get_record’,
reason: ‘wrong version number’,
code: ‘ESOCKET’,
command: ‘CONN’

It’s been working fine for the last 2 years, but stopped working on or around 7/22 (that was the last successful email request that came into to our server).

That said, I recently upgraded our development branch to a new version of Gatsby v3 which was deployed to the development branch on 6/26 and has been running without issue since. Recently, I continued upgrading our development branch from Gatsby v3 to v5 (which included upgrading our functions from Lambda to Netlify and bumping node from 16 to 18 via .nvmrc). Once again, I successfully deployed these changes to the development branch on 7/24. Since then I noticed in the function logs that our lambda function is failing trying to send emails. Thinking that it could be due to the Lambda-to-Netlify Functions changes, I rolled them back on the development branch and redeployed with the hope that the error would be resolved, but it’s still occurring.

I also created a simple function (deployed to production) to test this: send-test-email. Running the same function locally works fine.

Any insight into what might be going on? Let me know if you need any additional information.


Hey @kyeck,

It appears you’ve also written about this in the helpdesk.


Yes, I was desperate. :wink:

Thank you for your helpdesk replies.