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>&nbsp;TOC&nbsp;</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">&nbsp;</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">&nbsp;</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>&nbsp;TOC&nbsp;</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>&nbsp;
61SYNOPSIS<br></b>
62<b><a href="#anchor2">1.1</a>&nbsp;
63Requirements<br></b>
64<b><a href="#anchor3">1.2</a>&nbsp;
65Copyrights<br></b>
66<b><a href="#anchor4">2.</a>&nbsp;
67PHILOSOPHY<br></b>
68<b><a href="#anchor5">2.1</a>&nbsp;
69Guest Lists<br></b>
70<b><a href="#anchor6">3.</a>&nbsp;
71BEHAVIOR<br></b>
72<b><a href="#anchor7">3.1</a>&nbsp;
73Arguments<br></b>
74<b><a href="#actions">3.2</a>&nbsp;
75Actions<br></b>
76<b><a href="#configFile">3.3</a>&nbsp;
77The Configuration File<br></b>
78<b><a href="#options">3.3.1</a>&nbsp;
79Configuration Options<br></b>
80<b><a href="#procs">3.3.2</a>&nbsp;
81Configurable Procedures<br></b>
82<b><a href="#rfc.references1">&#167;</a>&nbsp;
83References<br></b>
84<b><a href="#rfc.authors">&#167;</a>&nbsp;
85Author's Address<br></b>
86<b><a href="#impersonal">A.</a>&nbsp;
87Impersonal Mail<br></b>
88<b><a href="#impersonal.options">A.1</a>&nbsp;
89Configuration Options<br></b>
90<b><a href="#options.foldersDirectory">A.1.1</a>&nbsp;
91foldersDirectory<br></b>
92<b><a href="#options.foldersFile">A.1.2</a>&nbsp;
93foldersFile<br></b>
94<b><a href="#options.announceMailboxes">A.1.3</a>&nbsp;
95announceMailboxes<br></b>
96<b><a href="#options.mappingFile">A.1.4</a>&nbsp;
97mappingFile<br></b>
98<b><a href="#impersonal.procs">A.2</a>&nbsp;
99Configurable Procedures<br></b>
100<b><a href="#procs.impersonalMail">A.2.1</a>&nbsp;
101impersonalMail<br></b>
102<b><a href="#procs.processFolder">A.2.2</a>&nbsp;
103processFolder<br></b>
104<b><a href="#anchor8">B.</a>&nbsp;
105An Example configFile<br></b>
106<b><a href="#anchor9">C.</a>&nbsp;
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>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
113<a name="rfc.section.1"></a><h3>1.&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
148<a name="rfc.section.2"></a><h3>2.&nbsp;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>&nbsp;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>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
247<a name="rfc.section.3"></a><h3>3.&nbsp;BEHAVIOR</h3>
248
249<a name="rfc.section.3.1"></a><h4><a name="anchor7">3.1</a>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;myMailbox</h4>
471
472<p>Your preferred email-address with commentary text, e.g.,
473</p></font><pre>
474    Arlington Hewes &lt;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;TOC&nbsp;</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>&nbsp;TOC&nbsp;</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">&nbsp;</td>
586<td class="author-text">Marshall T. Rose</td></tr>
587<tr><td class="author-text">&nbsp;</td>
588<td class="author-text">Dover Beach Consulting, Inc.</td></tr>
589<tr><td class="author-text">&nbsp;</td>
590<td class="author-text">POB 255268</td></tr>
591<tr><td class="author-text">&nbsp;</td>
592<td class="author-text">Sacramento, CA  95865-5268</td></tr>
593<tr><td class="author-text">&nbsp;</td>
594<td class="author-text">US</td></tr>
595<tr><td class="author" align="right">Phone:&nbsp;</td>
596<td class="author-text">+1 916 483 8878</td></tr>
597<tr><td class="author" align="right">Fax:&nbsp;</td>
598<td class="author-text">+1 916 483 8848</td></tr>
599<tr><td class="author" align="right">EMail:&nbsp;</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>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
605<a name="rfc.section.A"></a><h3>Appendix A.&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;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>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
767<a name="rfc.section.B"></a><h3>Appendix B.&nbsp;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 &lt;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>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
812<a name="rfc.section.C"></a><h3>Appendix C.&nbsp;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