Next: Mail Mode, Previous: Mail Format, Up: Sending Mail [Contents][Index]
There are several header fields you can use in the ‘*mail*’ buffer. Each header field starts with a field name at the beginning of a line, terminated by a colon. It does not matter whether you use upper or lower case in the field name. After the colon and optional whitespace comes the contents of the field.
This field contains the mailing addresses of the message.
The contents of the ‘Subject’ field should be a piece of text that says what the message is about. Subject fields are useful because most mail-reading programs can provide a summary of messages, listing the subject of each message but not its text.
This field contains additional mailing addresses to send the message to, but whose readers should not regard the message as addressed to them.
This field contains additional mailing addresses to send the message to, but which should not appear in the header of the message actually sent.
This field contains the name of one file (in Unix mail file format) to which a copy of the message should be appended when the message is sent.
Use the ‘From’ field to say who you are, when the account you are using to send the mail is not your own. The contents of the ‘From’ field should be a valid mailing address, since replies will normally go there.
Use the ‘Reply-To’ field to direct replies to a different address, not your own. ‘From’ and ‘Reply-To’ have the same effect on where replies go, but they convey a different meaning to the person who reads the message.
This field contains a piece of text describing a message you are replying to. Some mail systems can use the information to correlate related pieces of mail. This field is normally filled in by your mail handling package when you are replying to a message and you never need to think about it.
The ‘To’, ‘CC’, ‘BCC’ and ‘FCC’ fields can appear any number of times, to specify many places to send the message.
The ‘To’, ‘CC’, and ‘BCC’, fields can have continuation lines. All the lines starting with whitespace, following the line on which the field starts, are considered part of the field. For example,
To: foo@here, this@there, me@gnu.cambridge.mass.usa.earth.spiral3281
If you have a ~/.mailrc file, Emacs scans it for mail aliases the
first time you try to send mail in an Emacs session. Emacs expands
aliases found in the ‘To’, ‘CC’, and ‘BCC’ fields where
appropriate. You can set the variable mail-abbrev-mailrc-file
to
the name of the file with mail aliases. If nil
, ~/.mailrc
is used.
Your .mailrc file ensures that word-abbrevs are defined for each of your mail aliases when point is in a ‘To’, ‘CC’, ‘BCC’, or ‘From’ field. The aliases are defined in your .mailrc file or in a file specified by the MAILRC environment variable if it exists. Your mail aliases expand any time you type a word-delimiter at the end of an abbreviation.
In this version of Emacs, what you see is what you get: in contrast to some other versions, no abbreviations are expanded after you have sent the mail. This means you don’t suffer the annoyance of having the system do things behind your back—if the system rewrites an address you typed, you know it immediately, instead of after the mail has been sent and it’s too late to do anything about it. For example, you will never again be in trouble because you forgot to delete an old alias from your .mailrc and a new local user is given a userid which conflicts with one of your aliases.
Your mail alias abbrevs are in effect only when point is in an
appropriate header field. The mail aliases will not expand in the body
of the message, or in other header fields. The default mode-specific
abbrev table mail-mode-abbrev-table
is used instead if defined.
That means if you have been using mail-mode specific abbrevs, this code
will not adversely affect you. You can control which header fields the
abbrevs are used in by changing the variable mail-abbrev-mode-regexp
.
If auto-fill mode is on, abbrevs wrap at commas instead of at word boundaries, and header continuation lines will be properly indented.
You can also insert a mail alias with mail-interactive-insert-alias
.
This function, which is bound to C-c C-a, prompts you for an alias
(with completion) and inserts its expansion at point.
In this version of Emacs, it is possible to have lines like the following in your .mailrc file:
alias someone "John Doe <doe@quux.com>"
That is, if you want an address to have embedded spaces, simply surround it with double-quotes. The quotes are necessary because the format of the .mailrc file uses spaces as address delimiters.
Aliases in the .mailrc file may be nested. For example, assume you define aliases like:
alias group1 fred ethel alias group2 larry curly moe alias everybody group1 group2
When you now type ‘everybody’ on the ‘To’ line, it will expand to:
fred, ethyl, larry, curly, moe
Aliases may contain forward references; the alias of ‘everybody’ in the example above can precede the aliases of ‘group1’ and ‘group2’.
In this version of Emacs, you can use the source
.mailrc command
for reading aliases from some other file as well.
Aliases may contain hyphens, as in "alias foo-bar foo@bar"
, even
though word-abbrevs normally cannot contain hyphens.
To read in the contents of another .mailrc-type file from Emacs, use the
command M-x merge-mail-aliases
. The rebuild-mail-aliases
command is similar, but deletes existing aliases first.
If you want multiple addresses separated by a string other than ‘,’
(a comma), then set the variable mail-alias-separator-string
to
it. This has to be a comma bracketed by whitespace if you want any kind
of reasonable behavior.
If the variable mail-archive-file-name
is non-nil
, it
should be a string naming a file. Each time you start to edit a message
to send, an ‘FCC’ field is entered for that file. Unless you
remove the ‘FCC’ field, every message is written into that
file when it is sent.
Next: Mail Mode, Previous: Mail Format, Up: Sending Mail [Contents][Index]