Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29758

Using nodemailer with G suite

$
0
0

I have tried using nodemailer with gmail and it works. I tried to use the same code with my G suite name@mydomain.com email and there's bad credentials error. Is there an easy way to use nodemailer with G suite? because I want my business mail to be seen as sender.this is the code I am using:

let transporter = nodemailer.createTransport({  service: 'gmail',  auth: {    user: 'name@business.com',    pass: 'password'  }});exports.sendMail = functions.https.onRequest((req, res) => {cors(req, res, () => {    // getting dest email by query string    const dest = req.query.dest;    const mailOptions = {        from: 'Your Account Name <aegegwgwg@gmail.com>', // Something like: Jane Doe <janedoe@gmail.com>        to: dest,        subject: 'I\'M A PICKLE!!!', // email subject        html: `<p style="font-size: 16px;">Pickle Riiiiiiiiiiiiiiiick!!</p><br /><img src="https://images.prod.meredith.com/product/fc8754735c8a9b4aebb786278e7265a5/1538025388228/l/rick-and-morty-pickle-rick-sticker" />        ` // email content in HTML    };    // returning result    return transporter.sendMail(mailOptions, (erro, info) => {        if(erro){            return res.send(erro.toString());        }        return res.send('Sended');    });});    });

Viewing all articles
Browse latest Browse all 29758

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>