getting gmail to recognize the reply-to header Mar
30
1
1

I've been having issues with gmail not recognizing the reply-to email header when the "Reply-To" address was different than the "From" address. I inspected the headers and everything was set properly: something like:

from     "contact@example.com"
reply-to "user@gmail.com"
to       "contact@example.com"

In my case I am sending email to the site admin through a contact email form on the site. Because of the SMTP authentication security settings I'm forced to send the email from an authorized address. However, I want to reply to the user's email that they enter in the form. Because of this I can't set the "From" address to the address the user entered.

I noticed that gmail was ignoring the reply-to setting. When I replied to the email it was getting sent back to contact@example.com instead of user@gmail.com. Strangely, it turns out having the clients reply back to themselves wasn't exactly useful.

While doing some tests it seems that gmail ignores the "Reply-To" header when the "From" is one of the accepted "Send-As" addresses set in gmail. (Thank you Joshua) I don't know why this happens. Maybe it's a bug, maybe it's a security thing gmail is enforcing . . . I really don't have an answer why this happens.

After understanding what was happening to get around this behavior I set up a dummy email address, authorized it with the SMTP server, and forwarded all emails that get sent to the dummy address to the actual address that I want. The fields changed to something like:

from     "noreply@example.com"
reply-to "user@gmail.com"
to       "noreply@example.com"

and then I forwarded all emails sent to noreply@example.com to contact@example.com . After having that set up replies to the email correctly get sent to user@gmail.com instead of back to contact@example.com.

I know that it's not the most elegant setup, but hey, at least it works and the client is happy.

Bookmark and Share
blog comments powered by Disqus