I' m using the nodemailer, https://github.com/andris9/Nodemailer.
I tried with the example (with changed emails ofcourse). It's not working. Nothing get consoled out. After 30-40s I get:
{ [Error: Connection timeout] code: 'ETIMEDOUT' }
Error: connect ETIMEDOUT
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)
Any hint on what can be wrong? How do I debug?
Here's the code from the example. I pasted this into the server.js, so it fires when the app starts.
var nodemailer = require('nodemailer');
// create reusable transporter object using SMTP transport
var transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: 'gmail.user@gmail.com',
pass: 'userpass'
}
});
// NB! No need to recreate the transporter object. You can use
// the same transporter object for all e-mails
// setup e-mail data with unicode symbols
var mailOptions = {
from: 'Fred Foo ✔ <foo@blurdybloop.com>', // sender address
to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
subject: 'Hello ✔', // Subject line
text: 'Hello world ✔', // plaintext body
html: '<b>Hello world ✔</b>' // html body
};
// send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info){
if(error){
console.log(error);
}else{
console.log('Message sent: ' + info.response);
}
});
Update Turns out, my company has blocked googles smtp. So there was nothing wrong with the code.