Go forward to Mail Backend Variables.
Go backward to Getting Started Reading Mail.
Go up to Getting Mail.
Splitting Mail
--------------
The `nnmail-split-methods' variable says how the incoming mail is to
be split into groups.
(setq nnmail-split-methods
'(("mail.junk" "^From:.*Lars Ingebrigtsen")
("mail.crazy" "^Subject:.*die\\|^Organization:.*flabby")
("mail.other" "")))
This variable is a list of lists, where the first element of each of
these lists is the name of the mail group (they do not have to be called
something beginning with `mail', by the way), and the second element is
a regular expression used on the header of each mail to determine if it
belongs in this mail group.
The second element can also be a function. In that case, it will be
called narrowed to the headers with the first element of the rule as the
argument. It should return a non-`nil' value if it thinks that the
mail belongs in that group.
The last of these groups should always be a general one, and the
regular expression should *always* be `' so that it matches any mails
that haven't been matched by any of the other regexps.
If you like to tinker with this yourself, you can set this variable
to a function of your choice. This function will be called without any
arguments in a buffer narrowed to the headers of an incoming mail
message. The function should return a list of groups names that it
thinks should carry this mail message.
Note that the mail backends are free to maul the poor, innocent
incoming headers all they want to. They all add `Lines' headers; some
add `X-Gnus-Group' headers; most rename the Unix mbox `From<SPACE>'
line to something else.
The mail backends all support cross-posting. If several regexps
match, the mail will be "cross-posted" to all those groups.
`nnmail-crosspost' says whether to use this mechanism or not. Note
that no articles are crossposted to the general (`') group.
`nnmh' and `nnml' makes crossposts by creating hard links to the
crossposted articles. However, not all files systems support hard
links. If that's the case for you, set
`nnmail-crosspost-link-function' to `copy-file'. (This variable is
`add-name-to-file' by default.)
Gnus gives you all the opportunity you could possibly want for
shooting yourself in the foot. Let's say you create a group that will
contain all the mail you get from your boss. And then you accidentally
unsubscribe from the group. Gnus will still put all the mail from your
boss in the unsubscribed group, and so, when your boss mails you "Have
that report ready by Monday or you're fired!", you'll never see it and,
come Tuesday, you'll still believe that you're gainfully employed while
you really should be out collecting empty bottles to save up for next
month's rent money.