According to John Lange:
I'm not certain how much the sendmail differs from postfix but when I tried the below suggested in postfix it did not alter the Return-Path in the message header. -t allows you to extract recipients from the message headers but the Return-Path remained set to whichever user invoked the command.
In postfix you need the -f option as follows:
sendmail -t -f testing@taxpayer.com <<MAIL From: "Angry Taxpayer" testing@taxpayer.com To: "Dave" bob@taxisbad.com Reply-To: "Paul Martin" paulm@canadianrulingparty.gc.ca Subject: Tax cuts
That does seem to be the case with sendmail... As the man page indicates...
-fname Sets the name of the ``from'' person (i.e., the envelope sender of the mail). This address may also be used in the From: header if that header is missing during initial submission. The envelope sender address is used as the recipient for deliv- ery status notifications and may also appear in a Return-Path: header. -f should only be used by ``trusted'' users (normally root, daemon, and net- work) or if the person you are trying to become is the same as the person you are. Otherwise, an X- Authentication-Warning header will be added to the message. ... -t Read message for recipients. To:, Cc:, and Bcc: lines will be scanned for recipient addresses. The Bcc: line will be deleted before transmission.
So, in short, if you want to change the envelope "from" address, you need to use "-f". If you want to pull the list of recipients from the message headers, rather than explicitly list them on the command line, use "-t".