Website hosting and cheap domain name registration services

  Associate Sites:

Cheap domain registration

Search engine ranking and optimization

Domain name registration 

 

Node: Mail Aliases, Next: , Previous: Mail Headers, Up: Sending Mail



Mail Aliases

You can define mail aliases in a file named ~/.mailrc. These are short mnemonic names which stand for mail addresses or groups of mail addresses. Like many other mail programs, Emacs expands aliases when they occur in the To, From, CC, BCC, and Reply-to fields, plus their Resent- variants.

To define an alias in ~/.mailrc, write a line in the following format:

     alias shortaddress fulladdresses
     

Here fulladdresses stands for one or more mail addresses for shortaddress to expand into. Separate multiple addresses with spaces; if an address contains a space, quote the whole address with a pair of double-quotes.

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
     

Emacs also recognizes include commands in .mailrc files. They look like this:

     source filename
     

The file ~/.mailrc is used primarily by other mail-reading programs; it can contain various other commands. Emacs ignores everything in it except for alias definitions and include commands.

Another way to define a mail alias, within Emacs alone, is with the define-mail-alias command. It prompts for the alias and then the full address. You can use it to define aliases in your .emacs file, like this:

     (define-mail-alias "maingnu" "gnu@gnu.org")
     

define-mail-alias records aliases by adding them to a variable named mail-aliases. If you are comfortable with manipulating Lisp lists, you can set mail-aliases directly. The initial value of mail-aliases is t, which means that Emacs should read .mailrc to get the proper value.

You can specify a different file name to use instead of ~/.mailrc by setting the variable mail-personal-alias-file.

Normally, Emacs expands aliases when you send the message. You do not need to expand mail aliases before sending the message, but you can expand them if you want to see where the mail will actually go. To do this, use the command M-x expand-mail-aliases; it expands all mail aliases currently present in the mail headers that hold addresses.

If you like, you can have mail aliases expand as abbrevs, as soon as you type them in (see Abbrevs). To enable this feature, execute the following:

     (add-hook 'mail-mode-hook 'mail-abbrevs-setup)
     

This can go in your .emacs file. See Hooks. If you use this feature, you must use define-mail-abbrev instead of define-mail-alias; the latter does not work with this package. Note that the mail abbreviation package uses the variable mail-abbrevs instead of mail-aliases, and that all alias names are converted to lower case.

The mail abbreviation package also provides the C-c C-a (mail-interactive-insert-alias) command, which reads an alias name (with completion) and inserts its definition at point. This is useful when editing the message text itself or a header field such as Subject in which Emacs does not normally expand aliases.

Note that abbrevs expand only if you insert a word-separator character afterward. However, you can rebind C-n and M-> to cause expansion as well. Here's how to do that:

     (add-hook 'mail-mode-hook
               (lambda ()
                 (substitute-key-definition
                   'next-line 'mail-abbrev-next-line
                   mail-mode-map global-map)
                 (substitute-key-definition
                   'end-of-buffer 'mail-abbrev-end-of-buffer
                   mail-mode-map global-map)))
     
 

 

 

 

Disclaimers: This documentation is provided for the benefits of Active-Venture.com website hosting customers only.

 
Quotes: You are . . . the lens in the beam. You can only receive, give, and possess the light as the lens does.The more faithfully you listen to the voices within you, the better you will hear what is sounding outside.Never measure the height of a mountain until you reach the top. Then you will see how low it was.Never look down to test the ground before taking your next step; only he who keeps his eye fixed on the far horizon will find the right road.Life only demands from you the strength you possess. Only one feat is possible--not to have run away.It is more noble to give yourself completely to one individual than to labor diligently for the salvation of the masses.