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 gnu@gnu.org
plus a local address of your own, put in this line:
alias maingnu gnu@gnu.org 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 <none@example.com>"
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" <none@example.com>
β.
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.