Search code examples
emailsendmailreturn-pathtmail

Correct format of an Return-Path header


My application uses sendmail to send outbound email. I set the 'From:' address using the following format:

Fred Dibnah <[email protected]>

I'm also setting the Reply-To and Return-Path headers using the exact same format.

This seems to work in the vast majority of cases but I have seen at least one instance in which this fails, namely when the name part of the above string contains a period (full stop):

Fred Dibnah, Inc. <[email protected]>

This fails deep inside the TMail code (I'm using Ruby) but it seems like a perfectly valid thing to do.

My question is, should I actually be setting the Return-Path and Reply-To headers using only the email address as opposed to the above Name + Email format? E.g.

[email protected]

Thanks.


Solution

  • In a situation like this, it is best to turn to the RFCs.

    Upon reading up on your question, it appears as if You shouldn't be setting the Return-Path value ever. The final destination SMTP server is supposed to be setting this value as it transitions the message to your mailbox (http://www.faqs.org/rfcs/rfc2821.html starting at 4.4).

    According to http://www.faqs.org/rfcs/rfc2822.html the Reply-To field can have the following formats

    1. local-part "@" domain ([email protected] for example)
    2. display-name (Fred Dibna for example)

    I would recommend using option 1 as it seems to be the most basic, and you will likely have less issues with that format. In choosing option 1, your Reply-To field should look like the following:

    Reply-To: [email protected]