Answer the question
In order to leave comments, you need to log in
How to send a simple email using node?
Good evening!
Help me figure out how to send to gmail or yandex.
Tried with nodemailer, both 0.7.* version and latest.
Gives an error message.
var mailOptions, nodemailer, transporter;
nodemailer = require('nodemailer');
transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: '[email protected]',
pass: '***'
}
});
mailOptions = {
from: 'Slavik <[email protected]>',
to: '',
subject: 'Hello',
html: '<b>test</b>'
};
transporter.sendMail(mailOptions, function(err, info) {
if (err) {
return console.log(err);
}
return console.log("Message sent: " + info.response);
});
{ [Error: No recipients defined] code: 'EENVELOPE' }
Answer the question
In order to leave comments, you need to log in
You have, as it were, the recipient (to) indicated by an empty string, and this is clearly written in the error message.
I'm trying to run it myself, too, but it doesn't accept a password either. Did you succeed?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question