I’m having trouble with Gmail not using the reply-to header correctly. I set up my ContactMailer like this:
def send_message(contact_form)
mail(
from: "[email protected]",
to: "[email protected]",
subject: "New contact message",
reply_to: contact_form.user.email_address
)
end
The emails get delivered fine using my [email protected] account. When I check the email headers after receiving it, everything looks correct:
from: [email protected]
reply-to: [email protected]
to: [email protected]
But here’s the weird part - when I click the reply button in Gmail, the recipient field shows “[email protected]” instead of “[email protected]” like it should. Is there something wrong with my setup or is this a Gmail issue?
gmail does this when the reply-to domain is different from the sender domain. its a security feature - gmail flags it as suspicious. try using a subdomain like [email protected] instead of noreply. that usually helps. also, check your dmarc policy isn’t too strict.
I encountered a similar issue with Gmail and its handling of reply-to headers. It seems that Gmail prioritizes the domain’s reputation over the header information when the sender is a noreply address. To resolve this, I changed the sender to a real email address, ensuring that emails come from [email protected] instead. This adjustment improved how Gmail recognized the reply-to header. Additionally, make sure your SPF and DKIM records are set up correctly; if email authentication fails, Gmail may ignore your specified headers.
This sounds like a Gmail client issue, not your code. I’ve seen this before - Gmail’s web interface sometimes caches reply addresses or has delays processing the reply-to header properly. Try refreshing your Gmail tab or logging out and back in. Also check if you’ve got any Gmail filters or rules that might be messing with reply-to processing. Test the same email in Outlook or Apple Mail to see if the reply-to header works there. If it works in other clients but not Gmail, then it’s definitely Gmail being weird, not your mailer setup.