I am new to nodejs and try to send mail from nodemailer module but it has error i.e \"Unsupported configuration, downgrade Nodemailer to v0.7.1 to use
You can try this one with Nodemailer V0.7.1. It worked for me.
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser());
app.get('/', function(req, res) {
var html = '';
res.send(html);
});
app.post('/', function(req, res) {
var userEmail = req.body.userEmail;
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport("SMTP", {
host: 'smtp.gmail.com',
secureConnection: false,
port: 587,
auth: {
user: 'dhruv******@gmail.com', //Sender Email id
pass: '**********' //Sender Email Password
}
});
var mailOptions = {
from: 'dhruv*******@gmail.com', // sender address
to: 'dhaval********@gmail.com', // list of receivers
subject: 'Message Form ' + userEmail, // Subject line
text: 'Hi....' + userEmail // plaintext body
};
transporter.sendMail(mailOptions, function(error, info) {
if (error) {
return console.log(error);
}
console.log('Message sent: ' + info.response);
var html = 'Hello: ' + userEmail + '.
' +
'Try again.';
res.send(html);
});
});
app.listen(80);