0
votes

'535-5.7.8 Username and Password not accepted. Learn more at\n535 5.7.8 https://support.google.com/mail/?p=BadCredentials x66sm1596680lff.64 - gsmtp' What can i do please. I amm trying to integrate email messaging into my app, even after going through the Gmail API activation and retrieving the client_id and client_secret, it still doesn't work out.

let express = require('express')
let formidable = require('formidable');
let nodemailer = require('nodemailer');
let router = express.Router();
let app = express()

app.use(express.static('dist'));
app.use(express.static('public'));
app.use('/email', router);
router.get('/', handleSayHello);
function handleSayHello(req, res){
    var transporter = nodemailer.createTransport({
        service: "Gmail",
            auth: {
            XOAuth2: {
            user: "[email protected]", 

            clientId: "my-generated-OAuthId",
            clientSecret: "my-generated-OAuthSecret",
                }
        }
    })



    var tex_t = `<h1 style = "text-align: center">Hello Joshua</h1>
            <p>How are you doing today</p>  
    `;
    var mailOptions = {
        to : '[email protected]',
        from: 'anotherDifferentUser',
        subject: 'Email Example',
        html: tex_t,
    };
    transporter.sendMail(mailOptions, function(error, info){
        if(error){
            console.log(error);
            res.json({yo: 'error'});
        }else{
            console.log("Message sent: " + info.response);
            res.json({yo: info.response});
        };
    });

}
app.set('port', (process.env.PORT || 3000));
app.listen(app.get("port"), ()=>{
    console.log("App listening at ", app.get('port'));
})
1
Did you actually check the link they gave you? - Bytewave
Yeah, i did, they told me to create an app password, which when i proceeded to do, it's like google already removed that setting. I really don't know what else to do - Joshua Oguma
I don't think there's any chance of people helping you without seeing your code. Questions about code really need to show the relevant code. - jfriend00
alright, i'll do so - Joshua Oguma

1 Answers

0
votes

guys finally, i searched for another emailjs which sent my emails even without having to use Gmail API and make client_ids or client_secrets. If i tried this nodemailer junk for almost 2 days with no success, i don't think it's worth investing any effort into it. Expecially when they are others like emailjs that works just fine.