Variable: nnmail-split-methods
nnmail-split-methods is a customizable variable defined in
nnmail.el.gz.
Value
(("mail.misc" ""))
Documentation
Incoming mail will be split according to this variable.
If you'd like, for instance, one mail group for mail from the
"4ad-l" mailing list, one group for junk mail and one for everything
else, you could do something like this:
(setq nnmail-split-methods
'(("mail.4ad" "From:.*4ad")
("mail.junk" "From:.*Lars\\\\|Subject:.*buy")
("mail.misc" "")))
As you can see, this variable is a list of lists, where the first
element in each "rule" is the name of the group (which, by the way,
does not have to be called anything beginning with "mail",
"yonka.zow" is a fine, fine name), and the second is a regexp that
nnmail will try to match on the header to find a fit.
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 element should always have "" as the regexp.
This variable can also have a function as its value, and it can
also have a fancy split method as its value. See
nnmail-split-fancy(var)/nnmail-split-fancy(fun) for an explanation of that syntax.
Probably introduced at or before Emacs version 20.4.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/nnmail.el.gz
(defcustom nnmail-split-methods '(("mail.misc" ""))
"Incoming mail will be split according to this variable.
If you'd like, for instance, one mail group for mail from the
\"4ad-l\" mailing list, one group for junk mail and one for everything
else, you could do something like this:
(setq nnmail-split-methods
\\='((\"mail.4ad\" \"From:.*4ad\")
(\"mail.junk\" \"From:.*Lars\\\\|Subject:.*buy\")
(\"mail.misc\" \"\")))
As you can see, this variable is a list of lists, where the first
element in each \"rule\" is the name of the group (which, by the way,
does not have to be called anything beginning with \"mail\",
\"yonka.zow\" is a fine, fine name), and the second is a regexp that
nnmail will try to match on the header to find a fit.
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 element should always have \"\" as the regexp.
This variable can also have a function as its value, and it can
also have a fancy split method as its value. See
`nnmail-split-fancy' for an explanation of that syntax."
:group 'nnmail-split
:type '(choice (repeat :tag "Alist" (group (string :tag "Name")
(choice regexp function)))
(function-item nnmail-split-fancy)
(function :tag "Other")))