i am trying to send mail after user gets registered. I am using nodemailer for this. my code for this look like this-
var transporter = nodemailer.createTransport({
service:"Mailjet", // sets automatically host, port and connection security settings
auth: {
user:'******',
pass:'*******'
}
});
var mailOptions = {
to:mailTo,
from:'******',
subject:'user registered',
text:'welcome user'
};
transporter.sendMail(mailOptions, function(err, info) {
if (err) {
logger.debug('error in sending email ' + err);
} else {
logger.debug('Message sent: ' + info.response);
};
Mail is going properly when i use this on my localhost on my window machine but when i use this on my remote server which is a linux server. I get the following error :
error--- { Error: Connection timeout at SMTPConnection._formatError (/root/root/server/cq-code/node_modules/nodemailer/lib/smtp-connection/index.js:557:19) at SMTPConnection._onError (/root/root/server/cq-code/node_modules/nodemailer/lib/smtp-connection/index.js:530:20) at Timeout._connectionTimeout.setTimeout (/root/root/server/cq-code/node_modules/nodemailer/lib/smtp-connection/index.js:248:18) at ontimeout (timers.js:471:11) at tryOnTimeout (timers.js:306:5) at Timer.listOnTimeout (timers.js:266:5) code: 'ETIMEDOUT', command: 'CONN' } info----- undefined