I had this error using third-party smtp with the module 'nodemailer-smtp-transport' node.
My problem was that I used port 587.
When I switched it to 465, everything started to work.
My configuration looks like this:
const smtpConfiguration = { host: '<my smtp host>', port: 465, secure: true, // use TLS auth: { user: '<user account>', pass: '<password>' } };
And my email function (typescript, bluebird Promise):
export const SendEmail = (from:string, to:string[], subject:string, text:string, html:string) => { const transportOptions = smtpConfiguration; const transporter = nodemailer.createTransport(smtpTransport(transportOptions)); const emailOptions = { from: from, to: to.join(','), subject: subject, text: text, html: html }; return new Promise((resolve, reject) => { transporter.sendMail(emailOptions, (err, data) => { if (err) { return reject(err); } else { return resolve(data); } }); }); };
Mike cheel
source share