command line mail: setting the envelope from address

Solution 1:

It depends on which mail implementation you are using. For example, s-nail (aka Heirloom-mailx) accepts the set sendmail-arguments="..." option in mailrc, but it seems that bsd-mailx does not, neither does GNU mailutils.

However, I think you're trying to solve the problem at the wrong layer. The mail app doesn't interact with SMTP, so it shouldn't be worrying about SMTP envelope in the first place.

Instead, use Postfix's masquerade_domains to rewrite the Envelope-From centrally.