Nodemailer error: self signed certificate in certificate chain
I've searched for this but couldn't find an answer to my problem. here is my code
var xoauth2 = require('xoauth2');
var transporter = nodemailer.createTransport({
service: "Gmail",
auth: {
xoauth2: xoauth2.createXOAuth2Generator({
user: "dude@gmail.com",
clientId: "-",
clientSecret: "-",
refreshToken: "-"
})
}
});
app.post('/send', function (req, res) {
var mailOptions = {
from: 'dude',
to: 'derp@gmail.com',
subject: 'Email Example',
text: 'username: ' + req.body.firstname,
attachments:[
{
filename: req.files.myfile.name,
content: new Buffer(req.files.myfile.data,'utf-8')
}
]
};
transporter.sendMail(mailOptions, function(error, info){
if(error){
console.log(error);
res.send(error);
} else {
console.log('Message sent!!');
res.send('sent');
}
});
});
I had this problem when I was not using oauth2, now that I was using it I thought it would go away, but it is not. what am i doing wrong here?
+3
source to share