I asked the people from Next.js , but maybe Vercel would have a more direct answer? Here is the link from my post in the Next.js forum: https://github.com/vercel/next.js/discussions/74036
Apparently, after I change from Business Basics to Business Standard from Microsoft, my emails stopped working using Nodemailer and Next.js
The piece of code is this:
import nodemailer from "nodemailer";
export async function POST(req) { const transporter = nodemailer.createTransport({ service: "Outlook365", auth: { user: process.env.EMAIL, pass: process.env.EPASSWORD, },
tls: {rejectUnauthorized: true,// rejectUnauthorized: false, // Allow self-signed certificates (development only)// ca: fs.readFileSync('path/to/your/self-signed-cert.pem'),// since I don't have a file I copy and post it the SSL code given by Vercel.ca: process.env.SSLCERTIFICATE,},});
^^^ Up to a few weeks ago this code was working just fine without "tls" addtion
Today, if I do "rejectUnauthorized: false" <-- this would work, but now I am taking away security, and that is something I didn't need to do before.
The error I am now getting is this:
Error: self-signed certificate in certificate chain at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34) at TLSSocket.emit (node:events:524:28) at TLSSocket._finishInit (node:_tls_wrap:1078:8) at ssl.onhandshakedone (node:_tls_wrap:864:12) at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'ESOCKET', command: 'CONN'
^^^ Questions:
Isn't the SSL from Vercel not good enough for Microsoft Business Standard package?
Why was it working just a few weeks ago with Microsoft Business Basics? Why did it stop working today with Microsoft Business Standard?
No, I don't think Nodemailer would it have a problem with it either, since I has been working for years also.
** what is the feedback from Microsoft? **
Basically next to nothing. The most they told me was that they didn't know, that maybe I should ask Vercel first, and/or go buy a new SSL certificate to make it work..... but their feedback is all just "maybe" do this or that.