I googled this but could not find an answer for 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 used to have this problem back when i did not use oauth2, now that im using it i thought it would go away but it didnt. what am I doing wrong here?