in reply to sendmail return-path
The Return-path header is typically written into the headers by the remote mail daemon (the MTA, or mail transfer agent, as opposed to MUA, or mail user agent. Sendmail is a popular MTA. Outlook is a popular MUA).
So anyway, the MTA doing the final delivery writes the Return-path header (by convention (usually)) into the mail message. The value it writes in there is the envelope FROM address from the SMTP dialog. The spec says this address should be used for failure notices, etc, as opposed to replies (which should use the RFC 2822 header From: field, which is a different animal).
So your question, really, is "how do I set the envelope FROM field of an outbound mail message?" And the answer is, it can be a real pain, depending on your environment.
Assuming you're sending mail from some flavor of *nix:
You can invoke sendmail with the -f <foo@bar.com> flag to set the envelope FROM address. Different versions of sendmail will do different things with this, including honor it, ignore it, honor it only if you're root, and honor it but add an annoying warning header.
If you're using Qmail, you're in luck - qmail-inject can be invoked with a great deal of control over this, see the man page.
If you're sending mail from a Perl script, you can use Net::SMTP to have a great deal of control over the SMTP dialog, including specifying what value you use for the envelope FROM, but now you have the problem of figuring out what host to connect to (localhost will probably work), making sure that host will accept and route your mail appropriately, and dealing with the SMTP dialog.
I don't envy your problem - seemingly simple, it's actually quite tricky, and will probably result in having to learn a great deal about email to solve it. RFCs 2821 and 2822 are good places to start, so is the Net::SMTP module.
Good luck.
Peace,
-McD
|
|---|