Mail Backend Variables Getting Mail Mail and Procmail
If the rather simple, standard method for specifying how to split mail
doesn't allow you to do what you want, you can set
nnmail-split-methods
to nnmail-split-fancy
. Then you can
play with the nnmail-split-fancy
variable.
Let's look at an example value of this variable first:
;; Messages from the mailer daemon are not crossposted to any of ;; the ordinary groups. Warnings are put in a separate group ;; from real errors. (| ("from" mail (| ("subject" "warn.*" "mail.warning") "mail.misc")) ;; Non-error messages are crossposted to all relevant ;; groups, but we don't crosspost between the group for the ;; (ding) list and the group for other (ding) related mail. (& (| (any "ding@ifi\\.uio\\.no" "ding.list") ("subject" "ding" "ding.misc")) ;; Other mailing lists... (any "procmail@informatik\\.rwth-aachen\\.de" "procmail.list") (any "SmartList@informatik\\.rwth-aachen\\.de" "SmartList.list") ;; People... (any "larsi@ifi\\.uio\\.no" "people.Lars_Magne_Ingebrigtsen")) ;; Unmatched mail goes to the catch all group. "misc.misc")
This variable has the format of a split. A split is a (possibly) recursive structure where each split may contain other splits. Here are the five possible split syntaxes:
group
': If the split is a string, that will be taken as a group
name. Normal regexp match expansion will be done. See below for
examples.
|
(vertical bar), then process each SPLIT until one of them
matches. A SPLIT is said to match if it will cause the mail message to
be stored in one or more groups.
&
, then process all SPLITs in the list.
junk
: If the split is the symbol junk
, then don't save
this message. Use with extreme caution.
:
, then the second element will be called as a
function with args given as arguments. The function should return
a SPLIT.
nil
: If the split is nil
, it is ignored.
In these splits, FIELD must match a complete field name.
VALUE must match a complete word according to the fundamental mode
syntax table. You can use .*
in the regexps to match partial
field names or words. In other words, all VALUE's are wrapped in
`\<
' and `\>
' pairs.
FIELD and VALUE can also be lisp symbols, in that case they
are expanded as specified by the variable
nnmail-split-abbrev-alist
. This is an alist of cons cells, where
the car
of a cell contains the key, and the cdr
contains the associated
value.
nnmail-split-fancy-syntax-table
is the syntax table in effect
when all this splitting is performed.
If you want to have Gnus create groups dynamically based on some
information in the headers (i.e., do replace-match
-like
substitutions in the group names), you can say things like:
(any "debian-\\b\\(\\w+\\)@lists.debian.org" "mail.debian.\\1")
If the string contains the element `\&
', then the previously
matched string will be substituted. Similarly, the elements `\\1
'
up to `\\9
' will be substituted with the text matched by the
groupings 1 through 9.