32.3 Mail Aliases
You can define mail aliases, which are short mnemonic names
that stand for one or more mailing addresses. By default, mail
aliases are defined in the file ~/.mailrc
. You can specify a
different file name to use, by setting the variable
mail-personal-alias-file
.
To define an alias in ~/.mailrc
, write a line like this:
alias nick fulladdresses
This means that nick should expand into fulladdresses,
where fulladdresses can be either a single address, or multiple
addresses separated with spaces. For instance, to make maingnu
stand for [email protected]
plus a local address of your own, put in
this line:
alias maingnu [email protected] local-gnu
If an address contains a space, quote the whole address with a pair of double quotes, like this:
alias jsmith "John Q. Smith <[email protected]>"
Note that you need not include double quotes around individual parts
of the address, such as the person’s full name. Emacs puts them in if
they are needed. For instance, it inserts the above address as
‘ "John Q. Smith" <[email protected]>
’.
Emacs also recognizes include commands in ~/.mailrc
. They
look like this:
source filename
The ~/.mailrc
file is not unique to Emacs; many other
mail-reading programs use it for mail aliases, and it can contain
various other commands. However, Emacs ignores everything except
alias definitions and include commands.
Mail aliases expand as abbrevs—that is to say, as soon as you type
a word-separator character after an alias (see Abbrevs). This
expansion takes place only within the ‘ To
’, ‘ From
’,
‘ CC
’, ‘ BCC
’, and ‘ Reply-To
’ header fields (plus their
‘ Resent-
’ variants); it does not take place in other header
fields, such as ‘ Subject
’.
You can also insert an aliased address directly, using the command
M-x mail-abbrev-insert-alias
. This reads an alias name, with
completion, and inserts its definition at point.