I\'m sending an email to myself using a module (nodemailer) on my web application\'s platform (node.js) from someone using my web app\'s contact page. Since, I\'m sending an
Usually adding a Reply-To:
header will be sufficient for indicating which address replies should be sent to.
I don't know anything about Nodemailer, but their documentation seems to indicate that it supports setting the replyTo property - which sounds like what you want? All major email clients use an email's reply-to field to send a response if it exists.
Add a replyTo field to the mailOptions object. That worked for me. It's also in their docs.
The from will still show your email but replies will go to the replyTo email. Also, make sure you use the '"Fred Foo" ' syntax in the from field and you will see the sender's name on the conversation from field.
I had exactly the same problem and found the solution in this StackOverflow thread, which pointed to this forum:
If the "From" address is either the same as the "To" address, or is configured in GMail Settings as one of the 'Send As...' accounts, Gmail replies to the "To" address instead of the "Reply-To" address. An easy workaround is to specify a non-Gmail "From" address
I wasted quite a bit of time before finding the solution. Hope this helps out other people.
After reading all the answers, here's what worked for me:
Specify BOTH "from" and "replyTo" fields (with the email you want to reply to), not only one or the other.
This allows you to still use a Gmail account to send those messages.