update for rename of docs/user/DebugKernelCrashDumps.mdwn to docs/user/list/DebugKern...
[ikiwiki.git] / docs / handbook / handbook-mail-procmail.mdwn
1 \r
2 \r
3 ## Using procmail \r
4 \r
5 ***Contributed by Marc Silver. ***\r
6 \r
7 The ***procmail*** utility is an incredibly powerful application used to filter incoming mail. It allows users to define ***rules*** which can be matched to incoming mails to perform specific functions or to reroute mail to alternative mailboxes and/or email addresses.  **procmail**  can be installed using the [mail/procmail](http://pkgsrc.se/mail/procmail) port. Once installed, it can be directly integrated into most MTAs; consult your MTA documentation for more information. Alternatively,  **procmail**  can be integrated by adding the following line to a `.forward` in the home directory of the user utilizing  **procmail**  features:\r
8 \r
9     \r
10     "|exec /usr/local/bin/procmail || exit 75"\r
11 \r
12 \r
13 The following section will display some basic  **procmail**  rules, as well as brief descriptions on what they do. These rules, and others must be inserted into a `.procmailrc` file, which must reside in the user's home directory.\r
14 \r
15 Forward all mail from `user@example.com` to an external address of `goodmail@example2.com`:\r
16 \r
17     \r
18     :0\r
19     
20 * ^From.*user@example.com\r
21     ! goodmail@example2.com\r
22 \r
23 \r
24 Forward all mails shorter than 1000 bytes to an external address of `goodmail@example2.com`:\r
25 \r
26     \r
27     :0\r
28     
29 * < 1000\r
30     ! goodmail@example2.com\r
31 \r
32 \r
33 Send all mail sent to `alternate@example.com` into a mailbox called `alternate`:\r
34 \r
35     \r
36     :0\r
37     
38 * ^TOalternate@example.com\r
39     alternate\r
40 \r
41 \r
42 Send all mail with a subject of ***Spam*** to `/dev/null`:\r
43 \r
44     \r
45     :0\r
46     ^Subject:.*Spam\r
47     /dev/null\r
48 \r
49 \r
50 A useful recipe that parses incoming `dragonflybsd.org` mailing lists and places each list in its own mailbox:\r
51 \r
52     \r
53     :0\r
54     
55 * ^List-Post: &lt;mailto:\/[^@]+\r
56     {\r
57         LISTNAME=${MATCH}\r
58         :0\r
59     
60 * LISTNAME??^\/[^-]+\r
61         DragonFly-${MATCH}\r
62     }\r
63 \r
64 \r
65 \r
66 \r
67 CategoryHandbook\r
68 CategoryHandbook-email\r