GMail, Return-Path, and Lost Replies

I missed a couple of important e-mails while I was in Norway this past week. Although I was checking my metalab.unc.edu e-mail at least once a day, several important responses somehow went to my GMail address instead, which I was not checking. I found them when I got home and opened my Gmail account yesterday.

At first I was perplexed, because I do not usually set my return address to GMail. Then I remembered that on the road I was using the GMail SMTP server to send, because the Speakeasy server I normally use only works from my local area network behind my router. Could GMail be rewriting my headers? So I did some experiments.

I sent e-mail to my UNC address from my laptop using the GMail SMTP server. I verified that the return address I was sending out was elharo@metalab.unc.edu. The message came through quickly and I received it on my desktop. It indeed seemed to come from elharo@metalab.unc.edu as it should. Then I hit “Reply”. The reply that opened was addressed to “erharold@gmail.com”. Weird. Had Google inserted a Reply-to header before forwarding my mail?

In fact, it had added a Return-Path header:

Return-Path: erharold@gmail.com

The From header appeared untouched, and there was no Reply-to header. Checking RFC 2821, I see that:

When the delivery SMTP server makes the “final delivery” of a message, it inserts a return-path line at the beginning of the mail data. This use of return-path is required; mail systems MUST support it. The return-path line preserves the information in the from the MAIL command. Here, final delivery means the message has left the SMTP environment. Normally, this would mean it had been delivered to the destination user or an associated mail drop, but in some cases it may be further processed and transmitted by another mail system.

So it seems like Google is indeed following the spec by setting the Return-Path header. However, reading further on in the RFC we find:

The primary purpose of the Return-path is to designate the address to which messages indicating non-delivery or other mail system failures are to be sent. For this to be unambiguous, exactly one return path SHOULD be present when the message is delivered. Systems using RFC 822 syntax with non-SMTP transports SHOULD designate an unambiguous address, associated with the transport envelope, to which error reports (e.g., non-delivery messages) should be sent.

RFC 2822 also clearly states:

In the absence of the “Reply-To:” field, replies SHOULD by default be sent to the mailbox(es) specified in the “From:” field unless otherwise specified by the person composing the reply.

In other words, the return path is only for automatic responses, such as “No such recipient”. It is not for deliberate replies composed by a human being. It is, in other words, not the reply-to address. If the Reply-to header is not set, the response should be sent to the From address, not to the Return-path. There is a bug here but it is in Thunderbird, and presumably other e-mail clients my correspondents were using. I have reported it to the Thunderbird Project as Bug #396273.

The workaround is to explicitly set the Reply-to address as well as the From address. For example, in Thunderbird go to Tools/Account Settings/user@host/:

Reply-to Address: elharo@example.com

The Reply-to header does override the Return-path header, at least in Thunderbird.

13 Responses to “GMail, Return-Path, and Lost Replies”

  1. Mark Armendariz Says:

    Great detective work. Well done, sir.

  2. StephenD Says:

    I’ve been able to use Speakeasy’s SMTP server when traveling. They changed the setup a while back to require a username/password and TLS to be able to send through mail.speakeasy.net from outside of Speakeasy’s IP address range.

  3. Xan Gregg Says:

    FYI, I checked the headers on a recent message sent to me via gmail. It didn’t have return-path — just (anonymously):

    From: Anon
    To: Me
    Sender: “anon@gmail.moc”

    Outlook 2007 and Mac Mail both correctly sent the reply to the From address. In the UI, Mail hid the gmail sender info while Outlook showed the From field as “anon@gmail.moc on behalf of Anon [anon@school.edu]“.

  4. Xan Gregg Says:

    Trying the headers again to avoid getting the angle brackets stripped:

    From: Anon <anon@school.edu>
    To: Me <me@pobox.moc>
    Sender: “anon@gmail.moc” <anon@gmail.moc>

  5. Pierre Says:

    Do you know how to do that in Mail?
    I was not able to find it :-(

    Thanks.

  6. Vv le Moki Says:

    I have the same issues.
    I want to use my smtp.gmail.com to send e-mails wherever I am, disregarding of the ISP I am connected to.
    What I can tell is that Outlook is the only e-mail program that seems to give “priority” to “return-path” over “reply-to” or “from” header.
    Eudora, Thunderbird, imp and all the other e-mail programs I tested are working correctly with Return-path set to a gmail address and a “from” or “reply-to” header(s) set to non-gmail address

    It seems that this is the case for Outlook express 6 to Outlook 2007. And this is not RFC compliant, of course…

  7. Vv le Moki Says:

    More tests and detective work:

    In fact, if you configure gmail to be able to send e-mails from your non-gmail address and configure it to reply with the e-mail address used in the original message, outlook will still consider your gmail address as the “by the way of” sender but the original sender e-mail address will be the correct one and the reply and reply-to buttons will/should work OK in outlook.

    However, if, like me, you have “catch all” addresses, it is hard to pre-fill ALL your potential addresses in gmail.

    But if you have only few fixed e-mail addresses, well, this trick (use the “other accounts and configure gmail to send e-mail “from” these accounts) could help

    HTH

    Me. Le Vv Moki

  8. Rafael Says:

    I use Thunderbird to see several gmail accounts using IMAP. The “Return Path” of all the messages I sent from all the accounts is one particular account, which I do not know how to choose or change, …………………. Any suggestion? Rafael

  9. Harold Zable Says:

    Thanks for the tip. You’ve brightened my day.

    –Harold Z.

  10. oyunlar1 Says:

    Do you know how to do that in Mail?
    I was not able to find

  11. u2 Says:

    This sounds more than annoying. My ISP recently switched email handling to google.

    I’m never using my ISP email account in communications. I always use other email accounts that are then forwarded to the ISP email account.

    My problem now is that this inclusion of the Return-Path reveals the ISP email account which I wanted to hide originally.

    The Reply-To is not really the solution. If the full header is displayed, the Return-Path is still clearly visible.

    Is there a way to suppress Return-Path or overwrite it?

    Thanks
    /u

  12. MI Says:

    I just tested Thunderbird 2.0.0.18, and replies seem to go to From, not Return-Path. I added the following simple file to my IMAP server:

    Return-Path: <my.return-path@example.com>
    Message-ID: <message.id.abcd@example.com>
    Date: Wed Nov 19 14:18:41 2008 +0100
    From: My From Address <my.from@example.com>
    To: My destination <my.to@example.com>
    Subject: Test replies with return-path
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit

    Where do replies go?

    Started Thunderbird and hit “reply”. The To address was the correct “my.from@example.com”. Note that there is no Reply-To in this minimal email.

  13. Suz Says:

    Thoughtful post and well written. Please write more on this if you have time.

Leave a Reply