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