README.html
1<html><head><title>The README file: The personal.tcl Mailbot</title>
2<meta http-equiv="Expires" content="Wed, 14 Aug 2002 20:43:57 +0000">
3<STYLE type='text/css'>
4 .title { color: #990000; font-size: 22px; line-height: 22px; font-weight: bold; text-align: right;
5 font-family: helvetica, arial, sans-serif }
6 .filename { color: #666666; font-size: 18px; line-height: 28px; font-weight: bold; text-align: right;
7 font-family: helvetica, arial, sans-serif }
8 p.copyright { color: #000000; font-size: 10px;
9 font-family: verdana, charcoal, helvetica, arial, sans-serif }
10 p { margin-left: 2em; margin-right: 2em; }
11 li { margin-left: 3em; }
12 ol { margin-left: 2em; margin-right: 2em; }
13 ul.text { margin-left: 2em; margin-right: 2em; }
14 pre { margin-left: 3em; color: #333333 }
15 ul.toc { color: #000000; line-height: 16px;
16 font-family: verdana, charcoal, helvetica, arial, sans-serif }
17 H3 { color: #333333; font-size: 16px; line-height: 16px; font-family: helvetica, arial, sans-serif }
18 H4 { color: #000000; font-size: 14px; font-family: helvetica, arial, sans-serif }
19 TD.header { color: #ffffff; font-size: 10px; font-family: arial, helvetica, san-serif; valign: top }
20 TD.author-text { color: #000000; font-size: 10px;
21 font-family: verdana, charcoal, helvetica, arial, sans-serif }
22 TD.author { color: #000000; font-weight: bold; margin-left: 4em; font-size: 10px; font-family: verdana, charcoal, helvetica, arial, sans-serif }
23 A:link { color: #990000; font-weight: bold;
24 font-family: MS Sans Serif, verdana, charcoal, helvetica, arial, sans-serif }
25 A:visited { color: #333333; font-weight: bold;
26 font-family: MS Sans Serif, verdana, charcoal, helvetica, arial, sans-serif }
27 A:name { color: #333333; font-weight: bold;
28 font-family: MS Sans Serif, verdana, charcoal, helvetica, arial, sans-serif }
29 .link2 { color:#ffffff; font-weight: bold; text-decoration: none;
30 font-family: monaco, charcoal, geneva, MS Sans Serif, helvetica, monotype, verdana, sans-serif;
31 font-size: 9px }
32 .RFC { color:#666666; font-weight: bold; text-decoration: none;
33 font-family: monaco, charcoal, geneva, MS Sans Serif, helvetica, monotype, verdana, sans-serif;
34 font-size: 9px }
35 .hotText { color:#ffffff; font-weight: normal; text-decoration: none;
36 font-family: charcoal, monaco, geneva, MS Sans Serif, helvetica, monotype, verdana, sans-serif;
37 font-size: 9px }
38</style>
39</head>
40<body bgcolor="#ffffff" text="#000000" alink="#000000" vlink="#666666" link="#990000">
41<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
42<table width="66%" border="0" cellpadding="0" cellspacing="0"><tr><td><table width="100%" border="0" cellpadding="2" cellspacing="1">
43<tr valign="top"><td width="33%" bgcolor="#666666" class="header">The README file</td><td width="33%" bgcolor="#666666" class="header">M. Rose</td></tr>
44<tr valign="top"><td width="33%" bgcolor="#666666" class="header"> </td><td width="33%" bgcolor="#666666" class="header">Dover Beach Consulting, Inc.</td></tr>
45<tr valign="top"><td width="33%" bgcolor="#666666" class="header"> </td><td width="33%" bgcolor="#666666" class="header">February 2002</td></tr>
46</table></td></tr></table>
47<div align="right"><font face="monaco, MS Sans Serif" color="#990000" size="+3"><b><br><span class="title">The personal.tcl Mailbot</span></b></font></div>
48<font face="verdana, helvetica, arial, sans-serif" size="2">
49
50<h3>Abstract</h3>
51
52<p>The personal.tcl mailbot implements a highly-specialized
53filter for personal messages.
54It MUST not be used by people who receive mailing list traffic in
55their personal mailboxes.
56</p><a name="toc"><br><hr size="1" shade="0"></a>
57<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
58<h3>Table of Contents</h3>
59<ul compact class="toc">
60<b><a href="#anchor1">1.</a>
61SYNOPSIS<br></b>
62<b><a href="#anchor2">1.1</a>
63Requirements<br></b>
64<b><a href="#anchor3">1.2</a>
65Copyrights<br></b>
66<b><a href="#anchor4">2.</a>
67PHILOSOPHY<br></b>
68<b><a href="#anchor5">2.1</a>
69Guest Lists<br></b>
70<b><a href="#anchor6">3.</a>
71BEHAVIOR<br></b>
72<b><a href="#anchor7">3.1</a>
73Arguments<br></b>
74<b><a href="#actions">3.2</a>
75Actions<br></b>
76<b><a href="#configFile">3.3</a>
77The Configuration File<br></b>
78<b><a href="#options">3.3.1</a>
79Configuration Options<br></b>
80<b><a href="#procs">3.3.2</a>
81Configurable Procedures<br></b>
82<b><a href="#rfc.references1">§</a>
83References<br></b>
84<b><a href="#rfc.authors">§</a>
85Author's Address<br></b>
86<b><a href="#impersonal">A.</a>
87Impersonal Mail<br></b>
88<b><a href="#impersonal.options">A.1</a>
89Configuration Options<br></b>
90<b><a href="#options.foldersDirectory">A.1.1</a>
91foldersDirectory<br></b>
92<b><a href="#options.foldersFile">A.1.2</a>
93foldersFile<br></b>
94<b><a href="#options.announceMailboxes">A.1.3</a>
95announceMailboxes<br></b>
96<b><a href="#options.mappingFile">A.1.4</a>
97mappingFile<br></b>
98<b><a href="#impersonal.procs">A.2</a>
99Configurable Procedures<br></b>
100<b><a href="#procs.impersonalMail">A.2.1</a>
101impersonalMail<br></b>
102<b><a href="#procs.processFolder">A.2.2</a>
103processFolder<br></b>
104<b><a href="#anchor8">B.</a>
105An Example configFile<br></b>
106<b><a href="#anchor9">C.</a>
107Acknowledgements<br></b>
108</ul>
109<br clear="all">
110
111<a name="anchor1"><br><hr size="1" shade="0"></a>
112<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
113<a name="rfc.section.1"></a><h3>1. SYNOPSIS</h3>
114
115<p>Create a <a href="#configFile">configuration file</a>
116and add this line to your ".forward" file:
117</p></font><pre>
118 "| LIB/mbot-1.1/personal.tcl -config FILE -user USER"
119</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
120
121<p>where "LIB" is where the Tcl library lives,
122"FILE" is the name of your configuration file,
123and "USER" is your username.
124</p>
125<a name="rfc.section.1.1"></a><h4><a name="anchor2">1.1</a> Requirements</h4>
126
127<p>This package requires:
128
129<ul class="text">
130<li><a href="http://sourceforge.net/projects/tcl/">Tcl version 8.3</a>
131or later
132</li>
133<li><a href="http://sourceforge.net/projects/tcllib/">tcl lib</a>
134</li>
135<li><a href="http://sourceforge.net/projects/tclx/">TclX version 8.0</a>
136or later
137</li>
138</ul><p>
139</p>
140<a name="rfc.section.1.2"></a><h4><a name="anchor3">1.2</a> Copyrights</h4>
141
142<p>(c) 1999-2002 Marshall T. Rose
143</p>
144<p>Hold harmless the author, and any lawful use is allowed.
145</p>
146<a name="anchor4"><br><hr size="1" shade="0"></a>
147<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
148<a name="rfc.section.2"></a><h3>2. PHILOSOPHY</h3>
149
150<p>The mailbot's philosophy is simple:
151
152<ul class="text">
153<li>The mailbot receives all of your incoming personal mail.
154</li>
155<li>You ALWAYS copy yourself on every message you send,
156so that the mailbot receives all of your outgoing personal mail.
157</li>
158<li>The mailbot performs six tasks, all optional:
159
160<ul class="text">
161<li>makes audit copies of your incoming and outgoing mail;
162</li>
163<li>performs duplicate supression;
164</li>
165<li>performs originator supression by rejecting messages from people
166who aren't your friends or on a guest list;
167</li>
168<li>performs content supression by rejecting messages that contain
169attachments with extensions on your prohibited list;
170</li>
171<li>sends a textual synopsis to your PDA; and,
172</li>
173<li>sends a copy to your remote mailbox.
174</li>
175</ul><p>
176</li>
177</ul><p>
178</p>
179<p>Do NOT use the personal.tcl mailbot if you receive mailing list
180traffic in your personal mailbox.
181When sending mail to a mailing list,
182either:
183
184<ul class="text">
185<li>use a "From" address that the personal.tcl mailbot will process as
186"impersonal" mail,
187(e.g., "hewes+ietf.general@example.com"); or,
188</li>
189<li>set the "Reply-To" for the message to the mailing list.
190</li>
191</ul><p>
192Consult <a href="#impersonal">Impersonal Mail</a> for information on how
193"impersonal" mail is identified and processed.
194</p>
195<a name="rfc.section.2.1"></a><h4><a name="anchor5">2.1</a> Guest Lists</h4>
196
197<p>Guest lists are an effective mechanism for cutting back on
198excessive mail.
199
200<ul class="text">
201<li>when the mailbot receives a message from you,
202it adds any recipients it finds to a permanent-guest list;
203</li>
204<li>when the mailbot receives a message from someone on a guest list,
205it adds any recipients it finds to a temporary-guest list; but,
206</li>
207<li>when the mailbot receives a message from someone not on any guest
208list,
209they get a rejection notice.
210</li>
211</ul><p>
212Note that in order to promote someone to the permanent-guest list,
213you must send them a message (with a copy to yourself).
214In most cases,
215simply replying to the original message accomplishes this.
216Of course,
217if you don't want to promote someone to the permanent-guest list,
218simply remove that address (or your address) from the list of
219recipients in your reply.
220</p>
221<p>Here are the fine points:
222
223<ul class="text">
224<li>rejection notices contain a passphrase that may be used at most
225once to bypass the guest list mechanism
226(notices also contain the original message to minimize type-in
227by the uninvited);
228</li>
229<li>a flip-flop is used to avoid mail loops; and,
230</li>
231<li>messages originated by an administrative address (e.g.,
232"Postmaster") bypass the guest list mechanism
233(unless the message refers to a previously-rejected message,
234in which case it is supressed).
235</li>
236</ul><p>
237</p>
238<p>The rejection notice should be written carefully to minimize an
239extreme negative reaction on the part of the uninvited.
240Of course,
241by allowing a passphrase,
242this provides something of a CQ test for the uninvited --
243if someone can't pass the test...
244</p>
245<a name="anchor6"><br><hr size="1" shade="0"></a>
246<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
247<a name="rfc.section.3"></a><h3>3. BEHAVIOR</h3>
248
249<a name="rfc.section.3.1"></a><h4><a name="anchor7">3.1</a> Arguments</h4>
250
251<p>The mailbot supports the following command line arguments:
252
253<blockquote class="text"><dl>
254<dt> -config configFile:</dt>
255<dd>
256specifies the name of the configuration file to use;
257</dd>
258<dt> -debug boolean:</dt>
259<dd>
260enables debug output;
261</dd>
262<dt> -file messageFile:</dt>
263<dd>
264specifies the name of the file containing the message;
265</dd>
266<dt> -originator orginatorAddress:</dt>
267<dd>
268specifies the email-address of the originator of the message; and,
269</dd>
270<dt> -user userName:</dt>
271<dd>
272specifies the user-identity of the recipient.
273</dd>
274</dl></blockquote><p>
275Note that if "-user" is given,
276then the working directory is set to userName's home directory before
277configFile is sourced,
278and the umask is set defensively.
279</p>
280<p>The default values are:
281</p></font><pre>
282 personal.tcl -config .personal-config.tcl \
283 -debug 0 \
284 -file - \
285 -originator "derived from message"
286</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
287
288<p>Given the default values,
289only "-user" need be specified.
290The reason is that if a message is being delivered to multiple local
291recipients,
292and if any of the ".forward" files are identical in content,
293then sendmail may not deliver the message to all of the local
294recipients.
295</p>
296<p>A few other (sendmail related) tips:
297
298<ul class="text">
299<li>If sendmail is configured with smrsh,
300you'll need to symlink personal.tcl into the
301/usr/libexec/sm.bin/ directory.
302</li>
303<li>Make sure that tclsh8.0 is in the path specified on the third-line
304of personal.tcl.
305</li>
306<li>You should chmod your ".forward" file to 0600.
307</li>
308</ul><p>
309</p>
310<a name="rfc.section.3.2"></a><h4><a name="actions">3.2</a> Actions</h4>
311
312<p>The mailbot begins by parsing its arguments,
313sourcing configFile,
314and then examining the incoming message:
315
316<ol class="text">
317<li>If <a href="#options.auditInFile">auditInFile</a> is set,
318a copy of the message is
319<a href="#procs.saveMessage">saved</a> there.
320</li>
321<li>If the message contains a previously-encountered "Message-ID",
322processing terminates.
323</li>
324<li>If the message's originator can not be determined,
325a copy of the message is
326<a href="#procs.saveMessage">saved</a> in the
327<a href="#options.defaultMaildrop">defaultMaildrop</a> and
328processing terminates.
329</li>
330<li>The originator's email-address is examined:
331
332<ol class="text">
333<li>If the originator appears to be an
334<a href="#procs.adminP">automated administrative process</a>,
335and if a previously rejected email-address is found in the message,
336processing terminates.
337</li>
338<li>Otherwise,
339if the originator isn't <a href="#procs.ownerP">the user</a>,
340or <a href="#procs.friendP">a friend</a>,
341or a permanent-access guest,
342or a temporary-access guest,
343and if <a href="#options.noticeFile">noticeFile</a> is set,
344then the message is rejected.
345</li>
346<li>Otherwise,
347each recipient email-address in the message's header is added to a guest
348list.
349(If the originator is <a href="#procs.ownerP">the user</a>,
350the permanent-guest list is used instead of the temporary-guest
351list.)
352</li>
353</ol><p>
354</li>
355<li>If the originator is the <a href="#procs.ownerP">the user</a>,
356then:
357
358<ol class="text">
359<li>If <a href="#options.auditOutFile">auditOutFile</a> is set,
360<a href="#procs.saveMessage">saved</a> there.
361</li>
362<li>Regardless, processing terminates.
363</li>
364</ol><p>
365</li>
366<li>If <a href="#options.pdaMailboxes">pdaMailboxes</a> is set,
367and if any plaintext is contained in the message,
368then the plaintext is sent to those email-addresses.
369</li>
370<li>If <a href="#options.remoteMailboxes">remoteMailboxes</a> is set,
371and if the message is successful resent to those email-addresses,
372then processing terminates.
373</li>
374<li>A copy of the message is
375<a href="#procs.saveMessage">saved</a> in the
376<a href="#options.defaultMaildrop">defaultMaildrop</a> and
377processing terminates.
378</li>
379</ol><p>
380</p>
381<a name="rfc.section.3.3"></a><h4><a name="configFile">3.3</a> The Configuration File</h4>
382
383<p>There are two kinds of information that may be defined in configFile:
384<a href="#options">configuration options</a> and
385<a href="#procs">configurable procedures</a>.
386</p>
387<p>Here's a simple example of a configFile for a user named
388"example":
389</p></font><pre>
390 set options(dataDirectory) .personal
391 set options(defaultMaildrop) /var/mail/example
392 set options(logFile) [file join .personal personal.log]
393 set options(noticeFile) [file join .personal notice.txt]
394</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
395
396<a name="rfc.section.3.3.1"></a><h4><a name="options">3.3.1</a> Configuration Options</h4>
397
398<p>configFile must define
399<a href="#options.dataDirectory">dataDirectory</a>
400and
401<a href="#options.defaultMaildrop">defaultMaildrop</a>.
402All other configuration options are optional.
403</p>
404<a name="rfc.section.3.3.1.1"></a><h4><a name="options.dataDirectory">3.3.1.1</a> dataDirectory</h4>
405
406<p>The directory where the mailbot keeps its databases.
407The subdirectories are:
408
409<blockquote class="text"><dl>
410<dt> badaddrs:</dt>
411<dd>the directory of rejected email-addresses
412</dd>
413<dt> inaddrs:</dt>
414<dd>the directory of originator email-addresses
415</dd>
416<dt> msgids:</dt>
417<dd>the directory of Message-IDs
418</dd>
419<dt> outaddrs:</dt>
420<dd>the permanent-guest list
421</dd>
422<dt> phrases:</dt>
423<dd>the directory of at-most-once passphrases
424</dd>
425<dt> tmpaddrs:</dt>
426<dd>the temporary-guest list
427</dd>
428</dl></blockquote><p>
429If you want to remove someone from a guest list,
430simply go to that directory and delete the corresponding file.
431</p>
432<a name="rfc.section.3.3.1.2"></a><h4><a name="options.defaultMaildrop">3.3.1.2</a> defaultMaildrop</h4>
433
434<p>The filename where messages are
435<a href="#procs.saveMessage">saved</a> for later viewing by
436your user agent.
437</p>
438<a name="rfc.section.3.3.1.3"></a><h4><a name="options.auditInFile">3.3.1.3</a> auditInFile</h4>
439
440<p>The filename where messages are
441<a href="#procs.saveMessage">saved</a> for audit purposes.
442</p>
443<a name="rfc.section.3.3.1.4"></a><h4><a name="options.auditOutFile">3.3.1.4</a> auditOutFile</h4>
444
445<p>The filename where your outgoing messages are
446<a href="#procs.saveMessage">saved</a> for audit purposes.
447</p>
448<a name="rfc.section.3.3.1.5"></a><h4><a name="options.dropNames">3.3.1.5</a> dropNames</h4>
449
450<p>A list of filename extensions for attachments that automatically
451cause the message to be rejected.
452</p>
453<a name="rfc.section.3.3.1.6"></a><h4><a name="options.friendlyDomains">3.3.1.6</a> friendlyDomains</h4>
454
455<p>A list used by <a href="#procs.friendP">friendP</a> giving
456the domain names where your friends live.
457</p>
458<a name="rfc.section.3.3.1.7"></a><h4><a name="options.friendlyfire">3.3.1.7</a> friendlyfire</h4>
459
460<p>If present and true,
461then someone sending a message both to you and someone you've
462previously sent mail to,
463is considered a friend.
464</p>
465<a name="rfc.section.3.3.1.8"></a><h4><a name="options.logFile">3.3.1.8</a> logFile</h4>
466
467<p>The filename where the mailbot
468<a href="#procs.tclLog">logs</a> its actions.
469</p>
470<a name="rfc.section.3.3.1.9"></a><h4><a name="options.myMailbox">3.3.1.9</a> myMailbox</h4>
471
472<p>Your preferred email-address with commentary text, e.g.,
473</p></font><pre>
474 Arlington Hewes <hewes@example.com>
475</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
476
477<a name="rfc.section.3.3.1.10"></a><h4><a name="options.noticeFile">3.3.1.10</a> noticeFile</h4>
478
479<p>The filename containing the textual notice sent when a message is
480rejected.
481Note that all occurrances of "%passPhrase%" within this file are
482replaced with an at-most-once passphrase allowing the originator to
483bypass the mailbot's filtering.
484Similarly,
485any occurrences of "%subject%" are replaced by the "Subject" of the
486incoming message.
487</p>
488<a name="rfc.section.3.3.1.11"></a><h4><a name="options.pdaMailboxes">3.3.1.11</a> pdaMailboxes</h4>
489
490<p>The email-addresses where a textual synopsis of the incoming message is
491sent.
492</p>
493<a name="rfc.section.3.3.1.12"></a><h4><a name="options.remoteMailboxes">3.3.1.12</a> remoteMailboxes</h4>
494
495<p>The email-addresses where a copy of the incoming message is resent.
496</p>
497<a name="rfc.section.3.3.2"></a><h4><a name="procs">3.3.2</a> Configurable Procedures</h4>
498
499<p>All of these procedures are defined in personal.tcl.
500You may override any of them in configFile.
501</p>
502<a name="rfc.section.3.3.2.1"></a><h4><a name="procs.adminP">3.3.2.1</a> adminP</h4>
503</font><pre>
504 proc adminP {local domain}
505</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
506
507<p>Returns "1" if the email-address is an automated administrative
508process.
509</p>
510<a name="rfc.section.3.3.2.2"></a><h4><a name="procs.friendP">3.3.2.2</a> friendP</h4>
511</font><pre>
512 proc friendP {local domain}
513</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
514
515<p>Returns "1" if the email-address is from a
516<a href="#options.friendlyDomains">friendly domain</a> or
517sub-domain.
518</p>
519<a name="rfc.section.3.3.2.3"></a><h4><a name="procs.ownerP">3.3.2.3</a> ownerP</h4>
520</font><pre>
521 proc ownerP {local domain}
522</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
523
524<p>Returns "1" if the email-address refers to the user
525(as determined by looking at
526<a href="#options.myMailbox">myMailbox</a>,
527<a href="#options.pdaMailboxes">pdaMailboxes</a>, and
528<a href="#options.remoteMailboxes">remoteMailboxes</a>.
529</p>
530<a name="rfc.section.3.3.2.4"></a><h4><a name="procs.saveMessage">3.3.2.4</a> saveMessage</h4>
531</font><pre>
532 proc saveMessage {inF {outF ""}}
533</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
534
535<p>Saves a copy of the message contained in the file inF.
536If the destination file,
537outF,
538isn't specified,
539it defaults to the
540<a href="#options.defaultMaildrop">defaultMaildrop</a>.
541</p>
542<a name="rfc.section.3.3.2.5"></a><h4><a name="procs.findPhrase">3.3.2.5</a> findPhrase</h4>
543</font><pre>
544 proc findPhrase {subject}
545</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
546
547<p>Returns "1" if a previously-allocated passphrase is present in the
548subject.
549If so,
550the passphrase is forgotten.
551</p>
552<a name="rfc.section.3.3.2.6"></a><h4><a name="procs.makePhrase">3.3.2.6</a> makePhrase</h4>
553</font><pre>
554 proc makePhrase {}
555</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
556
557<p>Returns an at-most-once passphrase for use with a rejection notice.
558</p>
559<a name="rfc.section.3.3.2.7"></a><h4><a name="procs.pruneDir">3.3.2.7</a> pruneDir</h4>
560</font><pre>
561 proc pruneDir {dir type}
562</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
563
564<p>Removes old entries from one of the mailbot's
565<a href="#options.dataDirectory">databases</a>.
566The second parameter is one of "addr", "msgid", or "phrase".
567</p>
568<a name="rfc.section.3.3.2.8"></a><h4><a name="procs.tclLog">3.3.2.8</a> tclLog</h4>
569</font><pre>
570 proc tclLog {message}
571</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
572
573<p>Writes a message to the <a href="#options.logFile">logFile</a>.
574</p>
575<a name="rfc.references1"><br><hr size="1" shade="0"></a>
576<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
577<h3>References</h3>
578<table width="99%" border="0">
579</table>
580
581<a name="rfc.authors"><br><hr size="1" shade="0"></a>
582<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
583<h3>Author's Address</h3>
584<table width="99%" border="0" cellpadding="0" cellspacing="0">
585<tr><td class="author-text"> </td>
586<td class="author-text">Marshall T. Rose</td></tr>
587<tr><td class="author-text"> </td>
588<td class="author-text">Dover Beach Consulting, Inc.</td></tr>
589<tr><td class="author-text"> </td>
590<td class="author-text">POB 255268</td></tr>
591<tr><td class="author-text"> </td>
592<td class="author-text">Sacramento, CA 95865-5268</td></tr>
593<tr><td class="author-text"> </td>
594<td class="author-text">US</td></tr>
595<tr><td class="author" align="right">Phone: </td>
596<td class="author-text">+1 916 483 8878</td></tr>
597<tr><td class="author" align="right">Fax: </td>
598<td class="author-text">+1 916 483 8848</td></tr>
599<tr><td class="author" align="right">EMail: </td>
600<td class="author-text"><a href="mailto:mrose@dbc.mtview.ca.us">mrose@dbc.mtview.ca.us</a></td></tr>
601</table>
602
603<a name="impersonal"><br><hr size="1" shade="0"></a>
604<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
605<a name="rfc.section.A"></a><h3>Appendix A. Impersonal Mail</h3>
606
607<p>If <a href="#procs.impersonalMail">impersonalMail</a>
608returns a non-empty string
609then the message is processed differently than the algorithm given in
610<a href="#actions">Actions</a>.
611Specifically:
612
613<ol class="text">
614<li>If the message contains a previously-encountered "Message-ID",
615processing terminates.
616</li>
617<li>If the message's originator can not be determined,
618processing terminates.
619</li>
620<li>The value returned by
621<a href="#procs.impersonalMail">impersonalMail</a>
622is the folder's name and is broken into one or more components
623seperated by dots (".").
624If there aren't at least two components,
625or if any of the components are empty
626(e.g., the folder is named "sys..announce"),
627then the message is bounced.
628</li>
629<li>If <a href="#options.mappingFile">mappingFile</a> exists,
630that file is examined to see if an entry is present for the folder.
631If so,
632the message is processed according to the value present,
633one of:
634
635<blockquote class="text"><dl>
636<dt> "ignore":</dt>
637<dd>the message is silently ignored;
638</dd>
639<dt> "bounce":</dt>
640<dd>the message is noisily bounced; or,
641</dd>
642<dt> otherwise:</dt>
643<dd>the message is resent to the address.
644</dd>
645</dl></blockquote><p>
646Regardless,
647if an entry was present for the folder,
648then processing terminates.
649</li>
650<li>The message is <a href="#procs.saveMessage">saved</a>
651in a file whose name is constructed by replacing each dot (".") in the
652folder name with a directory seperator
653(e.g., if the folder is named "sys.announce",
654then the file is called "announce" underneath the directory "sys"
655underneath the directory identified by
656<a href="#options.foldersDirectory">foldersDirectory</a>.
657</li>
658<li>Finally,
659the file identified by <a href="#options.foldersFile">foldersFile</a>
660is updated as necessary.
661</li>
662</ol><p>
663</p>
664<a name="rfc.section.A.1"></a><h4><a name="impersonal.options">A.1</a> Configuration Options</h4>
665
666<p>If "impersonal" mail is received,
667then <a href="#options.foldersFile">foldersFile</a> and
668<a href="#options.foldersDirectory">foldersDirectory</a>
669must exist.
670</p>
671<a name="rfc.section.A.1.1"></a><h4><a name="options.foldersDirectory">A.1.1</a> foldersDirectory</h4>
672
673<p>The directory where the mailbot keeps private folders.
674</p>
675<a name="rfc.section.A.1.2"></a><h4><a name="options.foldersFile">A.1.2</a> foldersFile</h4>
676
677<p>This file contains one line for each private folder.
678</p>
679<a name="rfc.section.A.1.3"></a><h4><a name="options.announceMailboxes">A.1.3</a> announceMailboxes</h4>
680
681<p>The email-addresses where an announcement is sent when a new
682private folder is created.
683</p>
684<a name="rfc.section.A.1.4"></a><h4><a name="options.mappingFile">A.1.4</a> mappingFile</h4>
685
686<p>The file consulted by the mailbot to determine how to process
687"impersonal" messages.
688Each line of the file consists of a folder name and value,
689seperated by a colon (":").
690There are three reserved values: "bounce", "ignore", and "store".
691</p>
692<a name="rfc.section.A.2"></a><h4><a name="impersonal.procs">A.2</a> Configurable Procedures</h4>
693
694<p>All of these procedures are defined in personal.tcl.
695You may override any of them in configFile.
696</p>
697<a name="rfc.section.A.2.1"></a><h4><a name="procs.impersonalMail">A.2.1</a> impersonalMail</h4>
698</font><pre>
699 proc impersonalMail {}
700</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
701
702<p>If the message is deemed "impersonal",
703return the name of a corresponding private folder;
704otherwise,
705return the empty-string.
706</p>
707<p>Many mail systems have a mechanism of passing additional
708information when performing final delivery using a program.
709With modern versions of sendmail,
710for example,
711if mail is sent to a local user named "user+detail",
712then,
713in the absense of an alias for either "user+detail" or "user+*",
714then the message is delivered to "user".
715The trick is to get sendmail to pass the "detail" part to the mailbot.
716</p>
717<p>At present,
718sendmail passes this information only if procmail is your local
719mailer.
720Here's how I do it:
721</p></font><pre>
722 *** _alias.c Tue Dec 29 10:42:25 1998
723 --- alias.c Sat Sep 18 21:51:35 1999
724 ***************
725 *** 813,818 ****
726 --- 813,821 ----
727 define('z', user->q_home, e);
728 define('u', user->q_user, e);
729 define('h', user->q_host, e);
730 +
731 + setuserenv("SUFFIX", user->q_host);
732 +
733 if (ForwardPath == NULL)
734 ForwardPath = newstr("\201z/.forward");
735</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
736
737<p>This makes available an environment variable called
738"SUFFIX" which has the "details" part.
739The drawback in this approach is that this information is lost if the
740message is re-queued for delivery
741(what's really needed is an addition to the .forward syntax to allow
742macros such as $h to be passed).
743</p>
744<p>The corresponding impersonalMail procedure is defined as:
745</p></font><pre>
746 proc impersonalMail {} {
747 global env
748
749 return $env(SUFFIX)
750 }
751</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
752
753<a name="rfc.section.A.2.2"></a><h4><a name="procs.processFolder">A.2.2</a> processFolder</h4>
754</font><pre>
755 proc processFolder {folderName mimeT} { return $string }
756</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
757
758<p>If an entry for the folder exists in the
759<a href="#options.mappingFile">mappingFile</a>,
760and if the value for that entry is "process",
761then this procedure is invoked to return a string indicating what
762action to take
763(cf., <a href="#impersonal">Impersonal Mail</a>).
764</p>
765<a name="anchor8"><br><hr size="1" shade="0"></a>
766<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
767<a name="rfc.section.B"></a><h3>Appendix B. An Example configFile</h3>
768
769<p>Here is the ".forward" file for the user "hewes":
770</p></font><pre>
771 "|/usr/pkg/lib/mbot-1.1/personal.tcl
772 -config .personal/config.tcl -user hewes"
773</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
774
775<p>(Of course, it's all on one line.)
776</p>
777<p>Here is the user's ".personal/config.tcl" file:
778</p></font><pre>
779 array set options [list \
780 dataDirectory .personal \
781 defaultMaildrop /var/mail/hewes \
782 auditInFile [file join .personal INCOMING] \
783 auditOutFile [file join .personal OUTGOING] \
784 friendlyDomains [list tcp.int example.com] \
785 logFile [file join .personal personal.log] \
786 myMailbox "Arlington Hewes <hewes@example.com>" \
787 pdaMailboxes hewes.pager@example.com \
788 noticeFile [file join .personal notice.txt] \
789 foldersDirectory [file join .personal folders] \
790 foldersFile [file join .personal .mailboxlist] \
791 announceMailboxes hewes+sys.announce@example.com \
792 mappingFile [file join .personal mapping] \
793 friendlyFire 1 \
794 dropNames [list *.bat *.exe *.src *.pif *.wav *.vbs] \
795 ]
796
797 proc impersonalMail {} {
798 global env
799
800 return $env(SUFFIX)
801 }
802</pre><font face="verdana, helvetica, arial, sans-serif" size="2">
803
804<p>Note that because
805<a href="#options.remoteMailboxes">remoteMailboxes</a> isn't
806defined,
807personal messages are ultimately stored in the user's
808<a href="#options.defaultMaildrop">defaultMaildrop</a>.
809</p>
810<a name="anchor9"><br><hr size="1" shade="0"></a>
811<table border="0" cellpadding="0" cellspacing="2" width="30" height="15" align="right"><tr><td bgcolor="#990000" align="center" width="30" height="15"><a href="#toc" CLASS="link2"><font face="monaco, MS Sans Serif" color="#ffffff" size="1"><b> TOC </b></font></a><br></td></tr></table>
812<a name="rfc.section.C"></a><h3>Appendix C. Acknowledgements</h3>
813
814<p>The original version of this mailbot was written by the author in 1994,
815implemented using the safe-tcl package
816(Borenstein and Rose, circa 1993).
817</p></font></body></html>
818
README.txt
1
2
3The README file M. Rose
4 Dover Beach Consulting, Inc.
5 February 2002
6
7
8 The personal.tcl Mailbot
9
10
11Abstract
12
13 The personal.tcl mailbot implements a highly-specialized filter for
14 personal messages. It MUST not be used by people who receive mailing
15 list traffic in their personal mailboxes.
16
17Table of Contents
18
19 1. SYNOPSIS . . . . . . . . . . . . . . . . . . . . . . . . . . 2
20 1.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . 2
21 1.2 Copyrights . . . . . . . . . . . . . . . . . . . . . . . . . 2
22 2. PHILOSOPHY . . . . . . . . . . . . . . . . . . . . . . . . . 3
23 2.1 Guest Lists . . . . . . . . . . . . . . . . . . . . . . . . 4
24 3. BEHAVIOR . . . . . . . . . . . . . . . . . . . . . . . . . . 5
25 3.1 Arguments . . . . . . . . . . . . . . . . . . . . . . . . . 5
26 3.2 Actions . . . . . . . . . . . . . . . . . . . . . . . . . . 6
27 3.3 The Configuration File . . . . . . . . . . . . . . . . . . . 7
28 3.3.1 Configuration Options . . . . . . . . . . . . . . . . . . . 7
29 3.3.2 Configurable Procedures . . . . . . . . . . . . . . . . . . 10
30 References . . . . . . . . . . . . . . . . . . . . . . . . . 12
31 Author's Address . . . . . . . . . . . . . . . . . . . . . . 12
32 A. Impersonal Mail . . . . . . . . . . . . . . . . . . . . . . 13
33 A.1 Configuration Options . . . . . . . . . . . . . . . . . . . 14
34 A.1.1 foldersDirectory . . . . . . . . . . . . . . . . . . . . . . 14
35 A.1.2 foldersFile . . . . . . . . . . . . . . . . . . . . . . . . 14
36 A.1.3 announceMailboxes . . . . . . . . . . . . . . . . . . . . . 14
37 A.1.4 mappingFile . . . . . . . . . . . . . . . . . . . . . . . . 14
38 A.2 Configurable Procedures . . . . . . . . . . . . . . . . . . 15
39 A.2.1 impersonalMail . . . . . . . . . . . . . . . . . . . . . . . 15
40 A.2.2 processFolder . . . . . . . . . . . . . . . . . . . . . . . 16
41 B. An Example configFile . . . . . . . . . . . . . . . . . . . 17
42 C. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 18
43
44
45
46
47
48
49
50
51
52
53
54
55Rose [Page 1]
56
57README The personal.tcl Mailbot February 2002
58
59
601. SYNOPSIS
61
62 Create a configuration file (Section 3.3) and add this line to your
63 ".forward" file:
64
65 "| LIB/mbot-1.1/personal.tcl -config FILE -user USER"
66
67 where "LIB" is where the Tcl library lives, "FILE" is the name of
68 your configuration file, and "USER" is your username.
69
701.1 Requirements
71
72 This package requires:
73
74 o Tcl version 8.3 [1] or later
75
76 o tcl lib [2]
77
78 o TclX version 8.0 [3] or later
79
80
811.2 Copyrights
82
83 (c) 1999-2002 Marshall T. Rose
84
85 Hold harmless the author, and any lawful use is allowed.
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
111Rose [Page 2]
112
113README The personal.tcl Mailbot February 2002
114
115
1162. PHILOSOPHY
117
118 The mailbot's philosophy is simple:
119
120 o The mailbot receives all of your incoming personal mail.
121
122 o You ALWAYS copy yourself on every message you send, so that the
123 mailbot receives all of your outgoing personal mail.
124
125 o The mailbot performs six tasks, all optional:
126
127 * makes audit copies of your incoming and outgoing mail;
128
129 * performs duplicate supression;
130
131 * performs originator supression by rejecting messages from
132 people who aren't your friends or on a guest list;
133
134 * performs content supression by rejecting messages that contain
135 attachments with extensions on your prohibited list;
136
137 * sends a textual synopsis to your PDA; and,
138
139 * sends a copy to your remote mailbox.
140
141 Do NOT use the personal.tcl mailbot if you receive mailing list
142 traffic in your personal mailbox. When sending mail to a mailing
143 list, either:
144
145 o use a "From" address that the personal.tcl mailbot will process as
146 "impersonal" mail, (e.g., "hewes+ietf.general@example.com"); or,
147
148 o set the "Reply-To" for the message to the mailing list.
149
150 Consult Appendix A for information on how "impersonal" mail is
151 identified and processed.
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167Rose [Page 3]
168
169README The personal.tcl Mailbot February 2002
170
171
1722.1 Guest Lists
173
174 Guest lists are an effective mechanism for cutting back on excessive
175 mail.
176
177 o when the mailbot receives a message from you, it adds any
178 recipients it finds to a permanent-guest list;
179
180 o when the mailbot receives a message from someone on a guest list,
181 it adds any recipients it finds to a temporary-guest list; but,
182
183 o when the mailbot receives a message from someone not on any guest
184 list, they get a rejection notice.
185
186 Note that in order to promote someone to the permanent-guest list,
187 you must send them a message (with a copy to yourself). In most
188 cases, simply replying to the original message accomplishes this. Of
189 course, if you don't want to promote someone to the permanent-guest
190 list, simply remove that address (or your address) from the list of
191 recipients in your reply.
192
193 Here are the fine points:
194
195 o rejection notices contain a passphrase that may be used at most
196 once to bypass the guest list mechanism (notices also contain the
197 original message to minimize type-in by the uninvited);
198
199 o a flip-flop is used to avoid mail loops; and,
200
201 o messages originated by an administrative address (e.g.,
202 "Postmaster") bypass the guest list mechanism (unless the message
203 refers to a previously-rejected message, in which case it is
204 supressed).
205
206 The rejection notice should be written carefully to minimize an
207 extreme negative reaction on the part of the uninvited. Of course,
208 by allowing a passphrase, this provides something of a CQ test for
209 the uninvited -- if someone can't pass the test...
210
211
212
213
214
215
216
217
218
219
220
221
222
223Rose [Page 4]
224
225README The personal.tcl Mailbot February 2002
226
227
2283. BEHAVIOR
229
2303.1 Arguments
231
232 The mailbot supports the following command line arguments:
233
234 -config configFile: specifies the name of the configuration file
235 to use;
236
237 -debug boolean: enables debug output;
238
239 -file messageFile: specifies the name of the file containing the
240 message;
241
242 -originator orginatorAddress: specifies the email-address of the
243 originator of the message; and,
244
245 -user userName: specifies the user-identity of the recipient.
246
247 Note that if "-user" is given, then the working directory is set to
248 userName's home directory before configFile is sourced, and the umask
249 is set defensively.
250
251 The default values are:
252
253 personal.tcl -config .personal-config.tcl \
254 -debug 0 \
255 -file - \
256 -originator "derived from message"
257
258 Given the default values, only "-user" need be specified. The reason
259 is that if a message is being delivered to multiple local recipients,
260 and if any of the ".forward" files are identical in content, then
261 sendmail may not deliver the message to all of the local recipients.
262
263 A few other (sendmail related) tips:
264
265 o If sendmail is configured with smrsh, you'll need to symlink
266 personal.tcl into the /usr/libexec/sm.bin/ directory.
267
268 o Make sure that tclsh8.0 is in the path specified on the third-line
269 of personal.tcl.
270
271 o You should chmod your ".forward" file to 0600.
272
273
274
275
276
277
278
279Rose [Page 5]
280
281README The personal.tcl Mailbot February 2002
282
283
2843.2 Actions
285
286 The mailbot begins by parsing its arguments, sourcing configFile, and
287 then examining the incoming message:
288
289 1. If auditInFile (Section 3.3.1.3) is set, a copy of the message is
290 saved (Section 3.3.2.4) there.
291
292 2. If the message contains a previously-encountered "Message-ID",
293 processing terminates.
294
295 3. If the message's originator can not be determined, a copy of the
296 message is saved (Section 3.3.2.4) in the defaultMaildrop
297 (Section 3.3.1.2) and processing terminates.
298
299 4. The originator's email-address is examined:
300
301 1. If the originator appears to be an automated administrative
302 process (Section 3.3.2.1), and if a previously rejected
303 email-address is found in the message, processing terminates.
304
305 2. Otherwise, if the originator isn't the user (Section
306 3.3.2.3), or a friend (Section 3.3.2.2), or a permanent-
307 access guest, or a temporary-access guest, and if noticeFile
308 (Section 3.3.1.10) is set, then the message is rejected.
309
310 3. Otherwise, each recipient email-address in the message's
311 header is added to a guest list. (If the originator is the
312 user (Section 3.3.2.3), the permanent-guest list is used
313 instead of the temporary-guest list.)
314
315 5. If the originator is the the user (Section 3.3.2.3), then:
316
317 1. If auditOutFile (Section 3.3.1.4) is set, saved (Section
318 3.3.2.4) there.
319
320 2. Regardless, processing terminates.
321
322 6. If pdaMailboxes (Section 3.3.1.11) is set, and if any plaintext
323 is contained in the message, then the plaintext is sent to those
324 email-addresses.
325
326 7. If remoteMailboxes (Section 3.3.1.12) is set, and if the message
327 is successful resent to those email-addresses, then processing
328 terminates.
329
330 8. A copy of the message is saved (Section 3.3.2.4) in the
331 defaultMaildrop (Section 3.3.1.2) and processing terminates.
332
333
334
335Rose [Page 6]
336
337README The personal.tcl Mailbot February 2002
338
339
3403.3 The Configuration File
341
342 There are two kinds of information that may be defined in configFile:
343 configuration options (Section 3.3.1) and configurable procedures
344 (Section 3.3.2).
345
346 Here's a simple example of a configFile for a user named "example":
347
348 set options(dataDirectory) .personal
349 set options(defaultMaildrop) /var/mail/example
350 set options(logFile) [file join .personal personal.log]
351 set options(noticeFile) [file join .personal notice.txt]
352
353
3543.3.1 Configuration Options
355
356 configFile must define dataDirectory (Section 3.3.1.1) and
357 defaultMaildrop (Section 3.3.1.2). All other configuration options
358 are optional.
359
3603.3.1.1 dataDirectory
361
362 The directory where the mailbot keeps its databases. The
363 subdirectories are:
364
365 badaddrs: the directory of rejected email-addresses
366
367 inaddrs: the directory of originator email-addresses
368
369 msgids: the directory of Message-IDs
370
371 outaddrs: the permanent-guest list
372
373 phrases: the directory of at-most-once passphrases
374
375 tmpaddrs: the temporary-guest list
376
377 If you want to remove someone from a guest list, simply go to that
378 directory and delete the corresponding file.
379
3803.3.1.2 defaultMaildrop
381
382 The filename where messages are saved (Section 3.3.2.4) for later
383 viewing by your user agent.
384
3853.3.1.3 auditInFile
386
387 The filename where messages are saved (Section 3.3.2.4) for audit
388
389
390
391Rose [Page 7]
392
393README The personal.tcl Mailbot February 2002
394
395
396 purposes.
397
3983.3.1.4 auditOutFile
399
400 The filename where your outgoing messages are saved (Section 3.3.2.4)
401 for audit purposes.
402
4033.3.1.5 dropNames
404
405 A list of filename extensions for attachments that automatically
406 cause the message to be rejected.
407
4083.3.1.6 friendlyDomains
409
410 A list used by friendP (Section 3.3.2.2) giving the domain names
411 where your friends live.
412
4133.3.1.7 friendlyfire
414
415 If present and true, then someone sending a message both to you and
416 someone you've previously sent mail to, is considered a friend.
417
4183.3.1.8 logFile
419
420 The filename where the mailbot logs (Section 3.3.2.8) its actions.
421
4223.3.1.9 myMailbox
423
424 Your preferred email-address with commentary text, e.g.,
425
426 Arlington Hewes <hewes@example.com>
427
428
4293.3.1.10 noticeFile
430
431 The filename containing the textual notice sent when a message is
432 rejected. Note that all occurrances of "%passPhrase%" within this
433 file are replaced with an at-most-once passphrase allowing the
434 originator to bypass the mailbot's filtering. Similarly, any
435 occurrences of "%subject%" are replaced by the "Subject" of the
436 incoming message.
437
4383.3.1.11 pdaMailboxes
439
440 The email-addresses where a textual synopsis of the incoming message
441 is sent.
442
443
444
445
446
447Rose [Page 8]
448
449README The personal.tcl Mailbot February 2002
450
451
4523.3.1.12 remoteMailboxes
453
454 The email-addresses where a copy of the incoming message is resent.
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503Rose [Page 9]
504
505README The personal.tcl Mailbot February 2002
506
507
5083.3.2 Configurable Procedures
509
510 All of these procedures are defined in personal.tcl. You may
511 override any of them in configFile.
512
5133.3.2.1 adminP
514
515 proc adminP {local domain}
516
517 Returns "1" if the email-address is an automated administrative
518 process.
519
5203.3.2.2 friendP
521
522 proc friendP {local domain}
523
524 Returns "1" if the email-address is from a friendly domain (Section
525 3.3.1.6) or sub-domain.
526
5273.3.2.3 ownerP
528
529 proc ownerP {local domain}
530
531 Returns "1" if the email-address refers to the user (as determined by
532 looking at myMailbox (Section 3.3.1.9), pdaMailboxes (Section
533 3.3.1.11), and remoteMailboxes (Section 3.3.1.12).
534
5353.3.2.4 saveMessage
536
537 proc saveMessage {inF {outF ""}}
538
539 Saves a copy of the message contained in the file inF. If the
540 destination file, outF, isn't specified, it defaults to the
541 defaultMaildrop (Section 3.3.1.2).
542
5433.3.2.5 findPhrase
544
545 proc findPhrase {subject}
546
547 Returns "1" if a previously-allocated passphrase is present in the
548 subject. If so, the passphrase is forgotten.
549
5503.3.2.6 makePhrase
551
552 proc makePhrase {}
553
554 Returns an at-most-once passphrase for use with a rejection notice.
555
556
557
558
559Rose [Page 10]
560
561README The personal.tcl Mailbot February 2002
562
563
5643.3.2.7 pruneDir
565
566 proc pruneDir {dir type}
567
568 Removes old entries from one of the mailbot's databases (Section
569 3.3.1.1). The second parameter is one of "addr", "msgid", or
570 "phrase".
571
5723.3.2.8 tclLog
573
574 proc tclLog {message}
575
576 Writes a message to the logFile (Section 3.3.1.8).
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615Rose [Page 11]
616
617README The personal.tcl Mailbot February 2002
618
619
620References
621
622 [1] <http://sourceforge.net/projects/tcl/>
623
624 [2] <http://sourceforge.net/projects/tcllib/>
625
626 [3] <http://sourceforge.net/projects/tclx/>
627
628
629Author's Address
630
631 Marshall T. Rose
632 Dover Beach Consulting, Inc.
633 POB 255268
634 Sacramento, CA 95865-5268
635 US
636
637 Phone: +1 916 483 8878
638 Fax: +1 916 483 8848
639 EMail: mrose@dbc.mtview.ca.us
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671Rose [Page 12]
672
673README The personal.tcl Mailbot February 2002
674
675
676Appendix A. Impersonal Mail
677
678 If impersonalMail (Appendix A.2.1) returns a non-empty string then
679 the message is processed differently than the algorithm given in
680 Section 3.2. Specifically:
681
682 1. If the message contains a previously-encountered "Message-ID",
683 processing terminates.
684
685 2. If the message's originator can not be determined, processing
686 terminates.
687
688 3. The value returned by impersonalMail (Appendix A.2.1) is the
689 folder's name and is broken into one or more components seperated
690 by dots ("."). If there aren't at least two components, or if
691 any of the components are empty (e.g., the folder is named
692 "sys..announce"), then the message is bounced.
693
694 4. If mappingFile (Appendix A.1.4) exists, that file is examined to
695 see if an entry is present for the folder. If so, the message is
696 processed according to the value present, one of:
697
698 "ignore": the message is silently ignored;
699
700 "bounce": the message is noisily bounced; or,
701
702 otherwise: the message is resent to the address.
703
704 Regardless, if an entry was present for the folder, then
705 processing terminates.
706
707 5. The message is saved (Section 3.3.2.4) in a file whose name is
708 constructed by replacing each dot (".") in the folder name with a
709 directory seperator (e.g., if the folder is named "sys.announce",
710 then the file is called "announce" underneath the directory "sys"
711 underneath the directory identified by foldersDirectory (Appendix
712 A.1.1).
713
714 6. Finally, the file identified by foldersFile (Appendix A.1.2) is
715 updated as necessary.
716
717
718
719
720
721
722
723
724
725
726
727Rose [Page 13]
728
729README The personal.tcl Mailbot February 2002
730
731
732A.1 Configuration Options
733
734 If "impersonal" mail is received, then foldersFile (Appendix A.1.2)
735 and foldersDirectory (Appendix A.1.1) must exist.
736
737A.1.1 foldersDirectory
738
739 The directory where the mailbot keeps private folders.
740
741A.1.2 foldersFile
742
743 This file contains one line for each private folder.
744
745A.1.3 announceMailboxes
746
747 The email-addresses where an announcement is sent when a new private
748 folder is created.
749
750A.1.4 mappingFile
751
752 The file consulted by the mailbot to determine how to process
753 "impersonal" messages. Each line of the file consists of a folder
754 name and value, seperated by a colon (":"). There are three reserved
755 values: "bounce", "ignore", and "store".
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783Rose [Page 14]
784
785README The personal.tcl Mailbot February 2002
786
787
788A.2 Configurable Procedures
789
790 All of these procedures are defined in personal.tcl. You may
791 override any of them in configFile.
792
793A.2.1 impersonalMail
794
795 proc impersonalMail {}
796
797 If the message is deemed "impersonal", return the name of a
798 corresponding private folder; otherwise, return the empty-string.
799
800 Many mail systems have a mechanism of passing additional information
801 when performing final delivery using a program. With modern versions
802 of sendmail, for example, if mail is sent to a local user named
803 "user+detail", then, in the absense of an alias for either
804 "user+detail" or "user+*", then the message is delivered to "user".
805 The trick is to get sendmail to pass the "detail" part to the
806 mailbot.
807
808 At present, sendmail passes this information only if procmail is your
809 local mailer. Here's how I do it:
810
811 *** _alias.c Tue Dec 29 10:42:25 1998
812 --- alias.c Sat Sep 18 21:51:35 1999
813 ***************
814 *** 813,818 ****
815 --- 813,821 ----
816 define('z', user->q_home, e);
817 define('u', user->q_user, e);
818 define('h', user->q_host, e);
819 +
820 + setuserenv("SUFFIX", user->q_host);
821 +
822 if (ForwardPath == NULL)
823 ForwardPath = newstr("\201z/.forward");
824
825 This makes available an environment variable called "SUFFIX" which
826 has the "details" part. The drawback in this approach is that this
827 information is lost if the message is re-queued for delivery (what's
828 really needed is an addition to the .forward syntax to allow macros
829 such as $h to be passed).
830
831
832
833
834
835
836
837
838
839Rose [Page 15]
840
841README The personal.tcl Mailbot February 2002
842
843
844 The corresponding impersonalMail procedure is defined as:
845
846 proc impersonalMail {} {
847 global env
848
849 return $env(SUFFIX)
850 }
851
852
853A.2.2 processFolder
854
855 proc processFolder {folderName mimeT} { return $string }
856
857 If an entry for the folder exists in the mappingFile (Appendix
858 A.1.4), and if the value for that entry is "process", then this
859 procedure is invoked to return a string indicating what action to
860 take (cf., Appendix A).
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895Rose [Page 16]
896
897README The personal.tcl Mailbot February 2002
898
899
900Appendix B. An Example configFile
901
902 Here is the ".forward" file for the user "hewes":
903
904 "|/usr/pkg/lib/mbot-1.1/personal.tcl
905 -config .personal/config.tcl -user hewes"
906
907 (Of course, it's all on one line.)
908
909 Here is the user's ".personal/config.tcl" file:
910
911 array set options [list \
912 dataDirectory .personal \
913 defaultMaildrop /var/mail/hewes \
914 auditInFile [file join .personal INCOMING] \
915 auditOutFile [file join .personal OUTGOING] \
916 friendlyDomains [list tcp.int example.com] \
917 logFile [file join .personal personal.log] \
918 myMailbox "Arlington Hewes <hewes@example.com>" \
919 pdaMailboxes hewes.pager@example.com \
920 noticeFile [file join .personal notice.txt] \
921 foldersDirectory [file join .personal folders] \
922 foldersFile [file join .personal .mailboxlist] \
923 announceMailboxes hewes+sys.announce@example.com \
924 mappingFile [file join .personal mapping] \
925 friendlyFire 1 \
926 dropNames [list *.bat *.exe *.src *.pif *.wav *.vbs] \
927 ]
928
929 proc impersonalMail {} {
930 global env
931
932 return $env(SUFFIX)
933 }
934
935 Note that because remoteMailboxes (Section 3.3.1.12) isn't defined,
936 personal messages are ultimately stored in the user's defaultMaildrop
937 (Section 3.3.1.2).
938
939
940
941
942
943
944
945
946
947
948
949
950
951Rose [Page 17]
952
953README The personal.tcl Mailbot February 2002
954
955
956Appendix C. Acknowledgements
957
958 The original version of this mailbot was written by the author in
959 1994, implemented using the safe-tcl package (Borenstein and Rose,
960 circa 1993).
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007Rose [Page 18]
1008
1009
README.xml
1<?xml version="1.0"?>
2<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
3
4<?rfc compact="no"?>
5<?rfc toc="yes"?>
6<?rfc private="The README file"?>
7<?rfc header="README"?>
8
9<rfc>
10<front>
11<title>The personal.tcl Mailbot</title>
12
13<author initials="M.T." surname="Rose" fullname="Marshall T. Rose">
14<organization>Dover Beach Consulting, Inc.</organization>
15<address>
16<postal>
17<street>POB 255268</street>
18<city>Sacramento</city> <region>CA</region> <code>95865-5268</code>
19<country>US</country>
20</postal>
21<phone>+1 916 483 8878</phone>
22<facsimile>+1 916 483 8848</facsimile>
23<email>mrose@dbc.mtview.ca.us</email>
24</address>
25</author>
26
27<date month="February" year="2002" />
28
29<abstract><t>The personal.tcl mailbot implements a highly-specialized
30filter for personal messages.
31It MUST not be used by people who receive mailing list traffic in
32their personal mailboxes.</t></abstract>
33</front>
34
35<middle>
36<section title="SYNOPSIS">
37<figure>
38<preamble>Create a <xref target="configFile">configuration file</xref>
39and add this line to your ".forward" file:</preamble>
40<artwork><![CDATA[
41 "| LIB/mbot-1.1/personal.tcl -config FILE -user USER"
42]]></artwork>
43<postamble>where "LIB" is where the Tcl library lives,
44"FILE" is the name of your configuration file,
45and "USER" is your username.</postamble>
46</figure>
47
48<section title="Requirements">
49<t>This package requires:
50<list style="symbols">
51<t><eref target="http://sourceforge.net/projects/tcl/">Tcl version 8.3</eref>
52or later</t>
53
54<t><eref target="http://sourceforge.net/projects/tcllib/">tcl lib</eref></t>
55
56<t><eref target="http://sourceforge.net/projects/tclx/">TclX version 8.0</eref>
57or later</t>
58</list></t>
59</section>
60
61<section title="Copyrights">
62<t>(c) 1999-2002 Marshall T. Rose</t>
63
64<t>Hold harmless the author, and any lawful use is allowed.</t>
65</section>
66</section>
67
68<section title="PHILOSOPHY">
69<t>The mailbot's philosophy is simple:
70<list style="symbols">
71<t>The mailbot receives all of your incoming personal mail.</t>
72
73<t>You ALWAYS copy yourself on every message you send,
74so that the mailbot receives all of your outgoing personal mail.</t>
75
76<t>The mailbot performs six tasks, all optional:
77<list>
78<t>makes audit copies of your incoming and outgoing mail;</t>
79
80<t>performs duplicate supression;</t>
81
82<t>performs originator supression by rejecting messages from people
83who aren't your friends or on a guest list;</t>
84
85<t>performs content supression by rejecting messages that contain
86attachments with extensions on your prohibited list;</t>
87
88<t>sends a textual synopsis to your PDA; and,</t>
89
90<t>sends a copy to your remote mailbox.</t>
91</list></t>
92</list></t>
93
94<t>Do NOT use the personal.tcl mailbot if you receive mailing list
95traffic in your personal mailbox.
96When sending mail to a mailing list,
97either:
98<list style="symbols">
99<t>use a "From" address that the personal.tcl mailbot will process as
100"impersonal" mail,
101(e.g., "hewes+ietf.general@example.com"); or,</t>
102
103<t>set the "Reply-To" for the message to the mailing list.</t>
104</list>
105Consult <xref target="impersonal" /> for information on how
106"impersonal" mail is identified and processed.</t>
107
108<vspace blankLines="10000" />
109
110<section title="Guest Lists">
111<t>Guest lists are an effective mechanism for cutting back on
112excessive mail.
113<list style="symbols">
114<t>when the mailbot receives a message from you,
115it adds any recipients it finds to a permanent-guest list;</t>
116
117<t>when the mailbot receives a message from someone on a guest list,
118it adds any recipients it finds to a temporary-guest list; but,</t>
119
120<t>when the mailbot receives a message from someone not on any guest
121list,
122they get a rejection notice.</t>
123</list>
124Note that in order to promote someone to the permanent-guest list,
125you must send them a message (with a copy to yourself).
126In most cases,
127simply replying to the original message accomplishes this.
128Of course,
129if you don't want to promote someone to the permanent-guest list,
130simply remove that address (or your address) from the list of
131recipients in your reply.</t>
132
133<t>Here are the fine points:
134<list style="symbols">
135<t>rejection notices contain a passphrase that may be used at most
136once to bypass the guest list mechanism
137(notices also contain the original message to minimize type-in
138by the uninvited);</t>
139
140<t>a flip-flop is used to avoid mail loops; and,</t>
141
142<t>messages originated by an administrative address (e.g.,
143"Postmaster") bypass the guest list mechanism
144(unless the message refers to a previously-rejected message,
145in which case it is supressed).</t>
146</list></t>
147
148<t>The rejection notice should be written carefully to minimize an
149extreme negative reaction on the part of the uninvited.
150Of course,
151by allowing a passphrase,
152this provides something of a CQ test for the uninvited --
153if someone can't pass the test...</t>
154</section>
155</section>
156
157<section title="BEHAVIOR">
158<section title="Arguments">
159<t>The mailbot supports the following command line arguments:
160<list style="hanging">
161<t hangText=" -config configFile:">
162specifies the name of the configuration file to use;</t>
163
164<t hangText=" -debug boolean:">
165enables debug output;</t>
166
167<t hangText=" -file messageFile:">
168specifies the name of the file containing the message;</t>
169
170<t hangText=" -originator orginatorAddress:">
171specifies the email-address of the originator of the message; and,</t>
172
173<t hangText=" -user userName:">
174specifies the user-identity of the recipient.</t>
175</list>
176Note that if "-user" is given,
177then the working directory is set to userName's home directory before
178configFile is sourced,
179and the umask is set defensively.</t>
180
181<figure>
182<preamble>The default values are:</preamble>
183<artwork><![CDATA[
184 personal.tcl -config .personal-config.tcl \
185 -debug 0 \
186 -file - \
187 -originator "derived from message"
188]]></artwork>
189<postamble>Given the default values,
190only "-user" need be specified.
191The reason is that if a message is being delivered to multiple local
192recipients,
193and if any of the ".forward" files are identical in content,
194then sendmail may not deliver the message to all of the local
195recipients.</postamble>
196</figure>
197
198<t>A few other (sendmail related) tips:
199<list style="symbols">
200<t>If sendmail is configured with smrsh,
201you'll need to symlink personal.tcl into the
202/usr/libexec/sm.bin/ directory.</t>
203
204<t>Make sure that tclsh8.0 is in the path specified on the third-line
205of personal.tcl.</t>
206
207<t>You should chmod your ".forward" file to 0600.</t>
208</list></t>
209</section>
210
211<vspace blankLines="10000" />
212
213<section anchor="actions" title="Actions">
214<t>The mailbot begins by parsing its arguments,
215sourcing configFile,
216and then examining the incoming message:
217<list style="numbers">
218<t>If <xref target="options.auditInFile">auditInFile</xref> is set,
219a copy of the message is
220<xref target="procs.saveMessage">saved</xref> there.</t>
221
222<t>If the message contains a previously-encountered "Message-ID",
223processing terminates.</t>
224
225<t>If the message's originator can not be determined,
226a copy of the message is
227<xref target="procs.saveMessage">saved</xref> in the
228<xref target="options.defaultMaildrop">defaultMaildrop</xref> and
229processing terminates.</t>
230
231<t>The originator's email-address is examined:
232<list>
233<t>If the originator appears to be an
234<xref target="procs.adminP">automated administrative process</xref>,
235and if a previously rejected email-address is found in the message,
236processing terminates.</t>
237
238<t>Otherwise,
239if the originator isn't <xref target="procs.ownerP">the user</xref>,
240or <xref target="procs.friendP">a friend</xref>,
241or a permanent-access guest,
242or a temporary-access guest,
243and if <xref target="options.noticeFile">noticeFile</xref> is set,
244then the message is rejected.</t>
245
246<t>Otherwise,
247each recipient email-address in the message's header is added to a guest
248list.
249(If the originator is <xref target="procs.ownerP">the user</xref>,
250the permanent-guest list is used instead of the temporary-guest
251list.)</t>
252</list></t>
253
254<t>If the originator is the <xref target="procs.ownerP">the user</xref>,
255then:
256<list>
257<t>If <xref target="options.auditOutFile">auditOutFile</xref> is set,
258<xref target="procs.saveMessage">saved</xref> there.</t>
259
260<t>Regardless, processing terminates.</t>
261</list></t>
262
263<t>If <xref target="options.pdaMailboxes">pdaMailboxes</xref> is set,
264and if any plaintext is contained in the message,
265then the plaintext is sent to those email-addresses.</t>
266
267<t>If <xref target="options.remoteMailboxes">remoteMailboxes</xref> is set,
268and if the message is successful resent to those email-addresses,
269then processing terminates.</t>
270
271<t>A copy of the message is
272<xref target="procs.saveMessage">saved</xref> in the
273<xref target="options.defaultMaildrop">defaultMaildrop</xref> and
274processing terminates.</t>
275</list></t>
276</section>
277
278<section anchor="configFile" title="The Configuration File">
279<t>There are two kinds of information that may be defined in configFile:
280<xref target="options">configuration options</xref> and
281<xref target="procs">configurable procedures</xref>.</t>
282
283<figure>
284<preamble>Here's a simple example of a configFile for a user named
285"example":</preamble>
286<artwork><![CDATA[
287 set options(dataDirectory) .personal
288 set options(defaultMaildrop) /var/mail/example
289 set options(logFile) [file join .personal personal.log]
290 set options(noticeFile) [file join .personal notice.txt]
291]]></artwork>
292</figure>
293
294<section anchor="options" title="Configuration Options">
295<t>configFile must define
296<xref target="options.dataDirectory">dataDirectory</xref>
297and
298<xref target="options.defaultMaildrop">defaultMaildrop</xref>.
299All other configuration options are optional.</t>
300
301<section anchor="options.dataDirectory" title="dataDirectory">
302<t>The directory where the mailbot keeps its databases.
303The subdirectories are:
304<list style="hanging">
305<t hangText=" badaddrs:">the directory of rejected email-addresses</t>
306
307<t hangText=" inaddrs:">the directory of originator email-addresses</t>
308
309<t hangText=" msgids:">the directory of Message-IDs</t>
310
311<t hangText=" outaddrs:">the permanent-guest list</t>
312
313<t hangText=" phrases:">the directory of at-most-once passphrases</t>
314
315<t hangText=" tmpaddrs:">the temporary-guest list</t>
316</list>
317If you want to remove someone from a guest list,
318simply go to that directory and delete the corresponding file.</t>
319</section>
320
321<section anchor="options.defaultMaildrop" title="defaultMaildrop">
322<t>The filename where messages are
323<xref target="procs.saveMessage">saved</xref> for later viewing by
324your user agent.</t>
325</section>
326
327<section anchor="options.auditInFile" title="auditInFile">
328<t>The filename where messages are
329<xref target="procs.saveMessage">saved</xref> for audit purposes.</t>
330</section>
331
332<section anchor="options.auditOutFile" title="auditOutFile">
333<t>The filename where your outgoing messages are
334<xref target="procs.saveMessage">saved</xref> for audit purposes.</t>
335</section>
336
337<section anchor="options.dropNames" title="dropNames">
338<t>A list of filename extensions for attachments that automatically
339cause the message to be rejected.</t>
340</section>
341
342<section anchor="options.friendlyDomains" title="friendlyDomains">
343<t>A list used by <xref target="procs.friendP">friendP</xref> giving
344the domain names where your friends live.</t>
345</section>
346
347<section anchor="options.friendlyfire" title="friendlyfire">
348<t>If present and true,
349then someone sending a message both to you and someone you've
350previously sent mail to,
351is considered a friend.</t>
352</section>
353
354<section anchor="options.logFile" title="logFile">
355<t>The filename where the mailbot
356<xref target="procs.tclLog">logs</xref> its actions.</t>
357</section>
358
359<section anchor="options.myMailbox" title="myMailbox">
360<figure>
361<preamble>Your preferred email-address with commentary text, e.g.,</preamble>
362<artwork><![CDATA[
363 Arlington Hewes <hewes@example.com>
364]]></artwork>
365</figure>
366</section>
367
368<section anchor="options.noticeFile" title="noticeFile">
369<t>The filename containing the textual notice sent when a message is
370rejected.
371Note that all occurrances of "%passPhrase%" within this file are
372replaced with an at-most-once passphrase allowing the originator to
373bypass the mailbot's filtering.
374Similarly,
375any occurrences of "%subject%" are replaced by the "Subject" of the
376incoming message.</t>
377</section>
378
379<section anchor="options.pdaMailboxes" title="pdaMailboxes">
380<t>The email-addresses where a textual synopsis of the incoming message is
381sent.</t>
382</section>
383
384<section anchor="options.remoteMailboxes" title="remoteMailboxes">
385<t>The email-addresses where a copy of the incoming message is resent.</t>
386</section>
387</section>
388
389<vspace blankLines="10000" />
390
391<section anchor="procs" title="Configurable Procedures">
392<t>All of these procedures are defined in personal.tcl.
393You may override any of them in configFile.</t>
394
395<section anchor="procs.adminP" title="adminP">
396<figure>
397<artwork><![CDATA[
398 proc adminP {local domain}
399]]></artwork>
400</figure>
401
402<t>Returns "1" if the email-address is an automated administrative
403process.</t>
404</section>
405
406<section anchor="procs.friendP" title="friendP">
407<figure>
408<artwork><![CDATA[
409 proc friendP {local domain}
410]]></artwork>
411</figure>
412
413<t>Returns "1" if the email-address is from a
414<xref target="options.friendlyDomains">friendly domain</xref> or
415sub-domain.</t>
416</section>
417
418<section anchor="procs.ownerP" title="ownerP">
419<figure>
420<artwork><![CDATA[
421 proc ownerP {local domain}
422]]></artwork>
423</figure>
424
425<t>Returns "1" if the email-address refers to the user
426(as determined by looking at
427<xref target="options.myMailbox">myMailbox</xref>,
428<xref target="options.pdaMailboxes">pdaMailboxes</xref>, and
429<xref target="options.remoteMailboxes">remoteMailboxes</xref>.</t>
430</section>
431
432<section anchor="procs.saveMessage" title="saveMessage">
433<figure>
434<artwork><![CDATA[
435 proc saveMessage {inF {outF ""}}
436]]></artwork>
437</figure>
438
439<t>Saves a copy of the message contained in the file inF.
440If the destination file,
441outF,
442isn't specified,
443it defaults to the
444<xref target="options.defaultMaildrop">defaultMaildrop</xref>.</t>
445</section>
446
447<section anchor="procs.findPhrase" title="findPhrase">
448<figure>
449<artwork><![CDATA[
450 proc findPhrase {subject}
451]]></artwork>
452</figure>
453
454<t>Returns "1" if a previously-allocated passphrase is present in the
455subject.
456If so,
457the passphrase is forgotten.</t>
458</section>
459
460<section anchor="procs.makePhrase" title="makePhrase">
461<figure>
462<artwork><![CDATA[
463 proc makePhrase {}
464]]></artwork>
465</figure>
466
467<t>Returns an at-most-once passphrase for use with a rejection notice.</t>
468</section>
469
470<section anchor="procs.pruneDir" title="pruneDir">
471<figure>
472<artwork><![CDATA[
473 proc pruneDir {dir type}
474]]></artwork>
475</figure>
476
477<t>Removes old entries from one of the mailbot's
478<xref target="options.dataDirectory">databases</xref>.
479The second parameter is one of "addr", "msgid", or "phrase".</t>
480</section>
481
482<section anchor="procs.tclLog" title="tclLog">
483<figure>
484<artwork><![CDATA[
485 proc tclLog {message}
486]]></artwork>
487</figure>
488
489<t>Writes a message to the <xref target="options.logFile">logFile</xref>.</t>
490</section>
491</section>
492</section>
493
494</section>
495
496</middle>
497
498<back>
499<references />
500
501<section anchor="impersonal" title="Impersonal Mail">
502<t>If <xref target="procs.impersonalMail">impersonalMail</xref>
503returns a non-empty string
504then the message is processed differently than the algorithm given in
505<xref target="actions" />.
506Specifically:
507<list style="numbers">
508<t>If the message contains a previously-encountered "Message-ID",
509processing terminates.</t>
510
511<t>If the message's originator can not be determined,
512processing terminates.</t>
513
514<t>The value returned by
515<xref target="procs.impersonalMail">impersonalMail</xref>
516is the folder's name and is broken into one or more components
517seperated by dots (".").
518If there aren't at least two components,
519or if any of the components are empty
520(e.g., the folder is named "sys..announce"),
521then the message is bounced.</t>
522
523<t>If <xref target="options.mappingFile">mappingFile</xref> exists,
524that file is examined to see if an entry is present for the folder.
525If so,
526the message is processed according to the value present,
527one of:
528<list style="hanging">
529<t hangText=' "ignore":'>the message is silently ignored;</t>
530
531<t hangText=' "bounce":'>the message is noisily bounced; or,</t>
532
533<t hangText=" otherwise:">the message is resent to the address.</t>
534</list>
535Regardless,
536if an entry was present for the folder,
537then processing terminates.</t>
538
539<t>The message is <xref target="procs.saveMessage">saved</xref>
540in a file whose name is constructed by replacing each dot (".") in the
541folder name with a directory seperator
542(e.g., if the folder is named "sys.announce",
543then the file is called "announce" underneath the directory "sys"
544underneath the directory identified by
545<xref target="options.foldersDirectory">foldersDirectory</xref>.</t>
546
547<t>Finally,
548the file identified by <xref target="options.foldersFile">foldersFile</xref>
549is updated as necessary.</t>
550</list></t>
551
552<vspace blankLines="10000" />
553
554<section anchor="impersonal.options" title="Configuration Options">
555<t>If "impersonal" mail is received,
556then <xref target="options.foldersFile">foldersFile</xref> and
557<xref target="options.foldersDirectory">foldersDirectory</xref>
558must exist.</t>
559
560<section anchor="options.foldersDirectory" title="foldersDirectory">
561<t>The directory where the mailbot keeps private folders.</t>
562</section>
563
564<section anchor="options.foldersFile" title="foldersFile">
565<t>This file contains one line for each private folder.</t>
566</section>
567
568<section anchor="options.announceMailboxes" title="announceMailboxes">
569<t>The email-addresses where an announcement is sent when a new
570private folder is created.</t>
571</section>
572
573<section anchor="options.mappingFile" title="mappingFile">
574<t>The file consulted by the mailbot to determine how to process
575"impersonal" messages.
576Each line of the file consists of a folder name and value,
577seperated by a colon (":").
578There are three reserved values: "bounce", "ignore", and "store".</t>
579</section>
580</section>
581
582<vspace blankLines="10000" />
583
584<section anchor="impersonal.procs" title="Configurable Procedures">
585<t>All of these procedures are defined in personal.tcl.
586You may override any of them in configFile.</t>
587
588<section anchor="procs.impersonalMail" title="impersonalMail">
589<figure>
590<artwork><![CDATA[
591 proc impersonalMail {}
592]]></artwork>
593</figure>
594
595<t>If the message is deemed "impersonal",
596return the name of a corresponding private folder;
597otherwise,
598return the empty-string.</t>
599
600<t>Many mail systems have a mechanism of passing additional
601information when performing final delivery using a program.
602With modern versions of sendmail,
603for example,
604if mail is sent to a local user named "user+detail",
605then,
606in the absense of an alias for either "user+detail" or "user+*",
607then the message is delivered to "user".
608The trick is to get sendmail to pass the "detail" part to the mailbot.</t>
609
610<figure>
611<preamble>At present,
612sendmail passes this information only if procmail is your local
613mailer.
614Here's how I do it:</preamble>
615<artwork><![CDATA[
616 *** _alias.c Tue Dec 29 10:42:25 1998
617 --- alias.c Sat Sep 18 21:51:35 1999
618 ***************
619 *** 813,818 ****
620 --- 813,821 ----
621 define('z', user->q_home, e);
622 define('u', user->q_user, e);
623 define('h', user->q_host, e);
624 +
625 + setuserenv("SUFFIX", user->q_host);
626 +
627 if (ForwardPath == NULL)
628 ForwardPath = newstr("\201z/.forward");
629]]></artwork>
630<postamble>This makes available an environment variable called
631"SUFFIX" which has the "details" part.
632The drawback in this approach is that this information is lost if the
633message is re-queued for delivery
634(what's really needed is an addition to the .forward syntax to allow
635macros such as $h to be passed).</postamble>
636</figure>
637
638<figure>
639<preamble>The corresponding impersonalMail procedure is defined as:</preamble>
640<artwork><![CDATA[
641 proc impersonalMail {} {
642 global env
643
644 return $env(SUFFIX)
645 }
646]]></artwork>
647</figure>
648</section>
649
650<section anchor="procs.processFolder" title="processFolder">
651<figure>
652<artwork><![CDATA[
653 proc processFolder {folderName mimeT} { return $string }
654]]></artwork>
655</figure>
656
657<t>If an entry for the folder exists in the
658<xref target="options.mappingFile">mappingFile</xref>,
659and if the value for that entry is "process",
660then this procedure is invoked to return a string indicating what
661action to take
662(cf., <xref target="impersonal" />).</t>
663</section>
664</section>
665</section>
666
667<section title="An Example configFile">
668<figure>
669<preamble>Here is the ".forward" file for the user "hewes":</preamble>
670<artwork><![CDATA[
671 "|/usr/pkg/lib/mbot-1.1/personal.tcl
672 -config .personal/config.tcl -user hewes"
673]]></artwork>
674<postamble>(Of course, it's all on one line.)</postamble>
675</figure>
676
677<figure>
678<preamble>Here is the user's ".personal/config.tcl" file:</preamble>
679<artwork><![CDATA[
680 array set options [list \
681 dataDirectory .personal \
682 defaultMaildrop /var/mail/hewes \
683 auditInFile [file join .personal INCOMING] \
684 auditOutFile [file join .personal OUTGOING] \
685 friendlyDomains [list tcp.int example.com] \
686 logFile [file join .personal personal.log] \
687 myMailbox "Arlington Hewes <hewes@example.com>" \
688 pdaMailboxes hewes.pager@example.com \
689 noticeFile [file join .personal notice.txt] \
690 foldersDirectory [file join .personal folders] \
691 foldersFile [file join .personal .mailboxlist] \
692 announceMailboxes hewes+sys.announce@example.com \
693 mappingFile [file join .personal mapping] \
694 friendlyFire 1 \
695 dropNames [list *.bat *.exe *.src *.pif *.wav *.vbs] \
696 ]
697
698 proc impersonalMail {} {
699 global env
700
701 return $env(SUFFIX)
702 }
703]]></artwork>
704<postamble>Note that because
705<xref target="options.remoteMailboxes">remoteMailboxes</xref> isn't
706defined,
707personal messages are ultimately stored in the user's
708<xref target="options.defaultMaildrop">defaultMaildrop</xref>.</postamble>
709</figure>
710</section>
711
712<section title="Acknowledgements">
713<t>The original version of this mailbot was written by the author in 1994,
714implemented using the safe-tcl package
715(Borenstein and Rose, circa 1993).</t>
716</section>
717
718</back>
719
720</rfc>
721