1MAILDROPEX(7) Double Precision, Inc. MAILDROPEX(7)
2
3
4
6 maildropex - maildrop filtering language examples
7
9 $HOME/.mailfilter, $HOME/.mailfilters/*
10
11
13 If $HOME/.mailfilter exists, filtering instructions in this file will
14 be carried out prior to delivering the message. The filtering
15 instructions may instruct maildrop to discard the message, save the
16 message in a different mailbox, or forward the message to another
17 address. If $HOME/.mailfilter does not exist, or does not provide
18 explicit delivery instructions, maildrop delivers the message to the
19 user's system mailbox.
20
21 The files in $HOME/.mailfilters are used when maildrop is invoked in
22 embedded mode.
23
25 Take all mail that's sent to the 'auto' mailing list, and save it in
26 Mail/auto. The 'auto' mailing list software adds a "Delivered-To:
27 auto@domain.com" header to all messages:
28 After the to command delivers the message, maildrop automatically stops
29 filtering and terminates without executing the subsequent instructions
30 in the filter file.
31
32 Take all mail from <boss@domain.com> about the current project status,
33 save it in Mail/project, then forward a copy to John:
34 Note that it is necessary to use a backslash in order to continue the
35 if statement on the next line.
36
37 Keep copies of the last 50 messages that you received in the maildir
38 directory 'backup'. NOTE: 'backup' must be a maildir directory, not a
39 mailbox. You can create a maildir using the maildirmake command.
40 Put this at the beginning of your filter file, before any other
41 filtering instructions. This is a good idea to have when you are
42 learning maildrop. If you make a mistake and accidentally delete a
43 message, you can recover it from the backup/new subdirectory.
44
45 Save messages that are at least 100 lines long (approximately) into
46 Mail/IN.Large::
47
48 Send messages from the auto mailing list to the program 'archive',
49 using a lock file to make sure that only one instance of the archive
50 program will be running at the same time:
51
52 Check if the Message-ID: header in the message is identical to the same
53 header that was recently seen. Discard the message if it is, otherwise
54 continue to filter the message:
55 The reformail[1] command maintains a list of recently seen Message-IDs
56 in the file duplicate.cache.
57
58 Here's a more complicated example. This fragment is intended to go
59 right after the message has been filtered according to your regular
60 rules, and just before the message should be saved in your mailbox:
61
62 This code maintains a list of everyone who sent you mail in the file
63 called vacation.lst. When a message is received from anyone that is not
64 already on the list, the address is added to the list, and the contents
65 of the file vacation.msg are mailed back to the sender. This is
66 intended to reply notify people that you will not be answering mail for
67 a short period of time.
68
69 The first statement saves the original message in your regular mailbox.
70 Then, xfilter[2] is used to generate an autoreply header to the sender.
71 The To: header in the autoreply - which was the sender of the original
72 message - is extracted, and the getaddr[3] function is used to strip
73 the person's name, leaving the address only. The file vacation.lst is
74 checked, using a lock file to guarantee atomic access and update
75 (overkill, probably). Note that the backslashes are required.
76
77 If the address is already in the file, maildrop exits, otherwise the
78 contents of vacation.msg are appended to the autoreply header, and
79 mailed out.
80
81 Note
82 An easier to make a vacation script is with mailbot(1)[4].
83
84 Here's a version of the vacation script that uses a GDBM database file
85 instead. The difference between this script and the previous script is
86 that the previous script will send a vacation message to a given E-mail
87 address only once. The following script will store the time that the
88 vacation message was sent in the GDBM file. If it's been at least a
89 week since the vacation message has been sent to the given address,
90 another vacation message will be sent.
91
92 Even though a GDBM database file is used, locking is still necessary
93 because the GDBM library does not allow more than one process to open
94 the same database file for writing:
95
96 This script requires that maildrop must be compiled with GDBM support
97 enabled, which is done by default if GDBM libraries are present.
98
99 After you return from vacation, you can use a simple Perl script to
100 obtain a list of everyone who sent you mail (of course, that can also
101 be determined by examining your mailbox).
102
104 maildrop(1)[5], maildropfilter(7)[6], reformail(1)[1], mailbot(1)[4],
105 egrep(1), grep(1), sendmail(8).
106
108 1. reformail
109 reformail.html
110
111 2. xfilter
112 maildropfilter.html#xfilter
113
114 3. getaddr
115 maildropfilter.html#getaddr
116
117 4. mailbot(1)
118 mailbot.html
119
120 5. maildrop(1)
121 maildrop.html
122
123 6. maildropfilter(7)
124 maildropfilter.html
125
126
127
128Double Precision, Inc. 04/22/2007 MAILDROPEX(7)