Using nodemailer to send mail

Using nodemailer to send mail

Hi there!

We are using nodemailer in node to automate some mail sending. Until today it was working fine but now it throw an error of connection timeout.
The code bellow is the code im using. However I think it might be zoho that its blocking the request.


const nodemailer = require('nodemailer');
const mailConfig = require('./server/config/mail');

// create reusable transporter object using the default SMTP transport
const transporter = nodemailer.createTransport({
host: 'smtp.zoho.com',
port: '465',
secure: true, // true for 465, false for other ports
auth: {
user: mailConfig.sender_mail, // generated ethereal user
pass: process.env.password, // generated ethereal password
},
});


const send = (to, content, subject, sender) => {
return new Promise((resolve, reject) => {
if (!content) return reject(new Error('fail because mail content was empty'));
const options = {
from: `${sender}<${mailConfig.sender_mail}>`,
to,
subject,
text: '', // plain text body
html: content, // html body
};
return transporter.sendMail(options, (error, info) => {
if (error) return reject(error);
return resolve(info);
});
});
};

send('aa@aa.aa', 'content', 'subject', 'sender');


Thank you in advance,
Antonio