File: yample.1

package info (click to toggle)
yample 0.30-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 120 kB
  • sloc: perl: 668; makefile: 4
file content (363 lines) | stat: -rw-r--r-- 11,380 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "YAMPLE 1"
.TH YAMPLE 1 "2004-01-13" "perl v5.8.2" "User Contributed Perl Documentation"
.SH "NAME"
Yample \- Yet Another Mail Processing Language.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Yample is an \s-1MDA\s0 \- a mail delivery agent. It accepts a message via
standard input and stores this message in a maildir or in a mbox.
.PP
Yample tries to incorporate the power of Perl and Mail::Internet,
Mail::Spamassassin and the other Mail modules whilst maintaining an
friendly syntax. Yample was written due to a personal conflict with
Procmails syntax.
.PP
Look at the following lines, taken from \*(L"man procmailex\*(R";
.PP
:0 c
* ^From.*peter
* ^Subject:.*compilers
! william@somewhere.edu
.PP
.Vb 2
\&  :0 A
\&  petcompil
.Ve
.PP
This can be implemented like this in Yample;
.PP
sender(peter) and subject(compilers) unseen resend(william@somewhere.edu)
sender(peter) and subject(compilers) mbox(petcompil)
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-help\fR" 5
.IX Item "--help"
Help!
.IP "\fB\-\-mailbase <maildir\fR>" 5
.IX Item "--mailbase <maildir>"
This option is prepended to any destinations you have. Default is
~/Maildir/.
.IP "\fB\-\-logfile\fR" 5
.IX Item "--logfile"
Yamples logfile. Default is ~/.yample/log.
.IP "\fB\-\-loglevel <0\-4\fR>" 5
.IX Item "--loglevel <0-4>"
Loglevel. 4 \- Debug, 3 \- info, 2 \- warnings, 1 \- errors, 0 \- nothing.
.IP "\fB\-\-spamassassin\fR" 5
.IX Item "--spamassassin"
Load Mail::Spamassassin and run the mail through it.
.IP "\fB\-\-spamc\fR" 5
.IX Item "--spamc"
Run the message through spamc. Yample will look for spamc in the \f(CW$PATH\fR
unless you set \fB\-\-spamc\-path\fR.
.IP "\fB\-\-spamc\-path\fR /path/to/spamc" 5
.IX Item "--spamc-path /path/to/spamc"
Where spamc resides.
.IP "\fB\-\-dubdb <file\fR>" 5
.IX Item "--dubdb <file>"
The message id database \- used for duplicate suppression.
.IP "\fB\-\-rules <file\fR>" 5
.IX Item "--rules <file>"
The rule file.
.SH "FILES"
.IX Header "FILES"
.Sh "~/.yample/rules"
.IX Subsection "~/.yample/rules"
This file contains the rules which Yample uses to sort mail. Yample
reads the mail from \s-1STDIN\s0 and then processes the rules, one by one.
.PP
The rules consists of two parts; condition(s) and target. There is an
implicit if .. then .. else between every rule. Please see the
examples futher down.
.PP
In the conditions which take a regular expression as a parameter you can
use grouping to extract parts of the text and utilize this in the
sorting. Like this: \*(L"subject((.*)) and rcpt(user@foo.org): reject(Your
message with subject \f(CW$1\fR was rejected)\*(R". Cool, eh?
.PP
\&\s-1NOTE:\s0 We replace \*(L"/\*(R" and \*(L".\*(R" with \*(L"_\*(R" in grouped strings to make sure
there won't be any funny business.
.IP "Yample::Rules" 5
.IX Item "Yample::Rules"
This package contains subroutines which handle the individual
rules. The rules are transformed into perl code which will call these
methods to decide what to do with the message. 
.IP "\fIdup()\fR" 5
.IX Item "dup()"
Detects duplicates.
.IP "\fIrcpt()\fR" 5
.IX Item "rcpt()"
The rcpt rule matches against the To\- and Cc\-headers.
.IP "\fIsender()\fR" 5
.IX Item "sender()"
The sender rule matches against the From\-header.
.IP "\fIsubject()\fR" 5
.IX Item "subject()"
Matches on the subject of the message.
.IP "\fIlist()\fR" 5
.IX Item "list()"
If Yample can load Mail::Listdetect then \fIlist()\fR can be used to match
against the name of the mailing list (unless the mailing list server
is completely lame). 
.Sp
You can use this rule like this:
.Sp
list((.*)):      maildir(.lists.$1) 
.IP "\fIhead()\fR" 5
.IX Item "head()"
Match against a arbitrary header. Note the caret (^) 
.Sp
head(^X\-Spam\-Flag: \s-1YES\s0):               maildir(.junk.spam)
head(^X\-Infected:):                    maildir(.junk.virii)
.IP "\fIspam()\fR" 5
.IX Item "spam()"
If Yample loads Spamassassin (and runs the message through it) you can
use \fIspam()\fR to determine the status of the message.
.IP "\fIperl()\fR" 5
.IX Item "perl()"
Run arbitrary perl code. Unless you are some sort of pervert you would
not use this for anything but testing and debugging Yample.
.IP "Yample::Actions" 5
.IX Item "Yample::Actions"
Action dispatcher class. All the targets are defined here.
.IP "\fImaildir()\fR" 5
.IX Item "maildir()"
Stores the message in a UW-style maildir more or less as defined per
\&\s-1RFCXXXX\s0.
.IP "\fImbox()\fR" 5
.IX Item "mbox()"
Delivers mail to a standard Unix mailbox.
.Sp
Parameters: The mailbox where the message is to be delivered.
.IP "\fIresend()\fR" 5
.IX Item "resend()"
Parameters: Where the message is to be forwarded. 
.IP "\fIreject()\fR" 5
.IX Item "reject()"
Reject the message. This normally forces your mail server to create a
bounce and mail this to the original sender. 
.Sp
Parameters: Error message. This message will probably be included in
the bounce generated.
.IP "\fIignore()\fR" 5
.IX Item "ignore()"
Ignore the message silently.
.Sp
Parameters: none
.IP "\fIreply()\fR" 5
.IX Item "reply()"
Reply to the message.
.Sp
Parameters: The body of the reply.
.IP "\fIpipe()\fR" 5
.IX Item "pipe()"
Parameters: The command which is message is to be piped into. Executed
through \*(L"/bin/sh \-c\*(R".
.Sh "~/.yample/dupdb"
.IX Subsection "~/.yample/dupdb"
Yamples database of message IDs. Yample uses this to supress dupicate
messages (see \fIdup()\fR rules).
.Sh "~/.yample/log"
.IX Subsection "~/.yample/log"
Your own personal logfile. You might want to use logrotate or similar
programs to make sure it does not grow to big.
.Sh "~/.forward"
.IX Subsection "~/.forward"
Usually, your mail server looks for a file in your home directory called
\&\*(L".forward\*(R". This file contains information how your mail server should
deliver your mail. If you want Yample as your \s-1MDA\s0 your .forward should
look like this:
|/full/path/to/yample
.SH "EXAMPLES"
.IX Header "EXAMPLES"
# throw away virii
head(^X\-Infected:):                    \fIignore()\fR
.PP
# throw away spam with a score higher than 8
head(^X\-Spam\-Score: \ed+\e.\ed+ \e(\e+{8,}\e)
.PP
# The rest of the spam, tagged by spamassassin
head(^X\-Spam\-Flag: \s-1YES\s0):               maildir(.junk.spam)
.PP
\&\fIdup()\fR:                                 maildir(.junk.duplicates)
.PP
# auto-sort lists \- requires Mail::Listdetect
list((.*)):                            maildir(.lists.$1) 
.PP
sender(@fjase.net) and subject(Backup report): maildir(.backup_reports)
.PP
# catch-all
.PP
\&\fIperl\fR\|(1):                               \fImaildir()\fR
.SH "VERSION"
.IX Header "VERSION"
Yample 0.30
.SH "AUTHOR"
.IX Header "AUTHOR"
Per Andreas Buer <perbu (at) linpro.no>
.SH "PREREQUSITES"
.IX Header "PREREQUSITES"
Yamples needs the following perl modules. Please download from \s-1CPAN\s0,
Yamples home page or other sources.
.PP
Mail::Internet
Mail::Send
Text::Balanced
.PP
Yample also uses these modules \- but they are in the Perl
distribution so they should always be there. 
.PP
Pod::Usage
\&\s-1POSIX\s0
Sys::Hostname
IO::File
IPC::Open2
.SH "BUGS"
.IX Header "BUGS"
Yample with Spamassassin, Mail::ListDetector and the other bells and
whistles is quite heavy.
.PP
Please report bugs and functionality requests to the author.
.PP
Yample lacks (as of now) \s-1LMTP\s0 and \s-1IMAP\s0 support. Both should be fairly
easy to implement. 
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (C) 2003 Per Andreas Buer
.PP
This is free software; see the source for copying conditions. There is
\&\s-1NO\s0 warranty; not even for \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0
\&\s-1PURPOSE\s0.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Mail::Internet (3),  Mail::SpamAssassin (3), Mail::ListDetector (3).