On Thu, 20 Jan 2022, at 10:52, Chris Green wrote:
> The first one is easy (I think?!) but how can I do the second one
> where my_hdr bears no relation to the hostname?

According to the mutt man page:

> It is also possible to substitute the output of a Unix command in an 
> initialization file.  This is accomplished by enclosing the command in 
> backticks (`command`).

In a very simple case, setting From: based on shell logic:

my_hdr From: `case "$(hostname --fqdn)" in zbmc.eu) echo 'Chris Green 
<[email protected]>' ;; *) echo 'Chris Green <[email protected]>' ;;`

If you're always running from a shell that guarantees $HOSTNAME to be set, you 
could remove the subshell $(). You can also freely adjust the shell expression.

Another solution would be to reference an environment variable that always 
contains your email address. For example,

my_hdr From: "Chris Green <$EMAILADDRESS>"

with EMAILADDRESS= being set in the environment of any host you're using that 
muttrc on.

Reply via email to