mutt: changing sender mail address on the fly

Had a need today to adjust the sender email address for a notification script. Since the script uses mutt to send the emails, that change was fairly straight-forward. Instead of modifying .muttrc, simply export the EMAIL environmental variable. On the command line it looks something like this:

$ export EMAIL=’account@domain’
$ mutt <the rest of the mutt command line directives here…>

You can always combine the above into a single line if needed:

$ export EMAIL=’account@domain'; mutt <the rest of the mutt command line directives here…>

Btw, mutt is only a MUA (Mail User Agent) and not a MTA (Mail Transport Agent) and it relies on the underlying MTA to perform the mail delivery. In this case sendmail for us.