Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the from name with nodemailer and sestransport

I am sending emails from NodeJS using Nodemailer and sestransport on AWS, and am wondering how I can change the 'from name'?

fFr example, for from I put

    const mailOptions =
    {
      from:     '<[email protected]>',
      to:       '[email protected]',
      subject:  'Hi',
    }

When I get the email, it appears to come from 'noreply'. I would like to be able to change to name to anything, for example 'tom hanks', but still have the reply address [email protected]. Is that possible?

like image 633
user1709076 Avatar asked Mar 04 '23 13:03

user1709076


1 Answers

Simply specify it before the email address:

const mailOptions =
{
  from:     '"Tom Hanks" <[email protected]>',
  to:       '[email protected]',
  subject:  'Hi',
}
like image 138
MadWard Avatar answered Mar 08 '23 20:03

MadWard