Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodemailer send emails using original user account instead of alias

I have a problem with nodemailer where the user receive the email with sent from my google account which used to authenticate gmail instead of the alias used in mail options.

Below is my code:

var smtpTransport = nodemailer.createTransport({
    service: config.mailer.options.service,
    auth: {
        user: "[email protected]",
        pass: "password"
    }
});


var mailOptions = {
       to: user.email,
       from: 'Test Email <[email protected]>',
       subject: subject,
       html: emailHTML
};

smtpTransport.sendMail(mailOptions); Now when the user receive an email the email mentions that

from: Test Email [email protected]

Instead of showing

from: Test Email [email protected]

Any help please

like image 689
Dev Avatar asked Oct 31 '22 11:10

Dev


1 Answers

you also need to configure the alias in your gmail account. I faced the same issue but after configuring alias in gmail it worked. check this link to configure https://support.google.com/mail/answer/22370?hl=en

like image 160
Garima Bhatia Avatar answered Nov 15 '22 14:11

Garima Bhatia