whenever i run the code I'm getting the error " Error: Greeting never received at SMTPConnection._formatError...."
function automatedMailSender(req,res){
var mailOptions = {
from: "abc <abc@test.com>", // sender address
to: 'nit@test.com', // list of receivers
subject: 'Hello ', // Subject line
text: 'Hello world ?', // plain text body
html: '<b>Hello world ?</b>' // html body
};
var mailer=nodemailer.createTransport({
host: 'mail.test.com',
port: 465,
secure: false, // secure:true for port 465, secure:false for port 587
auth: {
user: 'mymail@test.com',
pass: '1234'
}
});
mailer.sendMail(mailOptions, (error, response)=>{
if(error){
console.log('mail not sent \n',error);
}
else{
console.log("Message sent: " ,response.message);
}
});
}
I'm I doing something wrong in the code.