Set email headers so bounced emails go to a specific address
Errors-To is deprecated, so mail servers will typically ignore this header - most servers will bounce will to the 'envelope sender'.
This is the email address that your mail client sends as part of the connection to the SMTP server (not necessarily the From address - though it typically is the same).
I don't know Rails all that well, but I found this - although, as far as I can tell Return-Path is reset by MTAs to match the MAIL FROM information from the client, so it seems you can't actually set it.
I think the only thing you can do is set the bounce address in your server.
From our rails app we send out some system-generated emails with the 'from' address set to email@example.com. If these bounce they get sent back to this address by our mail server. However, what i'd like to do is to not have bounced emails get sent back to firstname.lastname@example.org but to a different address, such as email@example.com.
Is there a header or something i can set in the email that will achieve this, without me having to go and investigate the vagaries of our email server? We send the mails out using exim in case that's relevant.
3 years too late, but just in case anyone else comes this way.
Return-Path is the right header but, as James Garriss pointed out above, it has to be placed there by the site performing final delivery. You can't just stick it in yourself.
If you're writing emails by connecting directly to an SMTP server then this is easy - the
to the SMTP server then bounces will be returned to
If you're not constructing SMTP, and you're running an MTA (ie. exim/etc), then you have to find a command-line switch for your MTA. For sendmail,
-f firstname.lastname@example.org "sets the sender's address", and this ends up as the
Return-Path in the final delivered mail, and
email@example.com will get the bounces (I do exactly this for auto-generated emails). I haven't tried this on exim, but it has exactly the same option, and it should work.