How to define a return-path using nodejs nodemailer?

1.1k Views Asked by At

I use nodemailer to send emails but I need to define the Return-Path.

I define in the address from, replyTo and also returnPath.

The returnPath (Return-Path) is writen like this: <[email protected]>

But it does not work. It always changes the Return-Path in the source code of the messages on the email server address. Any ideas? Thank you.

1

There are 1 best solutions below

0
On

Try using the envelope property

const mailOptions = {
    envelope: {
      'from': '<[email protected]>',
      'to': "[email protected]"
    },
    from: "Info <[email protected]>",
    to: "[email protected]",
    subject: "....",
    text: "Hello world",
    html: "<b>Hello world ✔</b>",
}

sendMail(mailOptions);

Do not omit the "< >"