Create and store email aliases for Mutt
Set up Mutt to store and retrieve aliases
First you want to create a file to store aliases, say .mail_aliases
. You could store aliases in your muttrc
file, however it is good practice not to do so (you might share your configuration files occasionally).
So, to create the file run:
$ touch ~/.mail_aliases
Once you’ve created .mail_aliases
you want to instruct muttrc
to use it. To do so run:
$ cat >> ~/.muttrc << EOF
> # Config for aliases
> source ~/.mail_aliases
> set alias_file=~/.mail_aliases
> EOF
This command appends three lines to the muttrc
file. The first line, i.e. the one starting with >
, is a mnemonic comment. The second line tells muttrc
to source the file. The third line tells Mutt where to save (and retrieve I guess?) aliases. EOF
is just used to delineate (frame) what is called ‘here document’, i.e. command << Input
1.
Create and store email aliases
When using Mutt, type the key a
to create an alias for the current message. Or run:
$ echo "alias alice alice@yctct.com (Alice Geepeegee)" >> ~/.email_aliases
Make sure you use two greater-than signs, i.e. >>
. If you use one only, all existing aliases will be replaced by the one you just added.
Now, next time you want to email Alice, just type alice
in the prompt. Note that you don’t need to type out the whole alias: use tab
to complete it.
There are options related to aliases you might want to look at: alias_file
, alias_format
, etc.. Check out Mutt’s manual which you can find on your system: /usr/share/doc/mutt/manual.txt.gz
.
See also:
Advanced Bash-Scripting Guide, An in-depth exploration of the art of shell scripting, Mendel Cooper; freely available↩︎
personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki mutt