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: "[email protected]",
clientId: "-",
clientSecret: "-",
refreshToken: "-"
})
}
});
app.post('/send', function (req, res) {
var mailOptions = {
from: 'dude',
to: '[email protected]',
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?
Ok so it was because of the Anti-Virus software. i swear things like this make me feel like quitting.
Same was with me. My antivirus is AVG. Instead of turning the antivirus off in AVG you can go to Settings>Components>Email Shield>Customize>SSL Scanning and uncheck "Scan SSL connections".
In Avast Go Settings/Protection/Core Shields/Configure shield settings/Mail Shield and uncheck "Scan outbound emails (SMTP)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With