<?xml version="1.0" encoding="euc-jp"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="ROBOTS" content="NOARCHIVE" />
<title>scmail: a mail filter written in Scheme</title>
<link rel="stylesheet" href="http://namazu.org/~satoru/satoru.css" media="all" type="text/css" />
</head>
<body>
<p class="lang-navigator">English | <a href="scmail-ja.html">Japanese</a></p>

<h1>scmail: a mail filter written in Scheme</h1>
<p class="last-modified">Last Modified: 2004-07-27 (Since: 2002-10-24)</p>
<hr />

<h2>What's scmail?</h2>
<p>scmail is a mail filter written in Scheme.
scmail can filter an incoming mail when it is received and filter
mails in a mailbox.  A bayesian spam filter called 
<a href="scbayes.html">scbayes</a> is also included.</p>

<!-- ad -->

<h2>What's new?</h2>
<ul>
<li><em>2004-07-27</em>: <a href="#download">scmail 1.3</a> Released!
<ul>
<li>Multiple occurrences of fields having the same name are now
      supported (ex. Delivered-To:).</li>
<li>Other small modifications have been also made.</li>
</ul></li>
<li><em>2004-03-11</em>: <a href="#download">scmail 1.2</a> Released!
<ul>
<li>New option --dry-run (-n) for scmail-refile/scmail-deliver is added.
      (it works just like make -n)</li>
<li>Short command line options are now supported.</li>
</ul></li>
<li><em>2004-02-05</em>: <a href="#download">scmail 1.0</a> Released! 
<ul>
<li>A spam filter called scbayes is now included
<ul>
<li>scbayes is developed by <a href="http://www.lava.net/~shiro/">Shiro Kawai</a>.</li>
</ul></li>
<li>Names of configuration files are changed.
      You can keep using old names but I recomend you to rename them.
<ul>
<li>~/.scmailrc -&gt; ~/.scmail/config</li>
<li>~/.scmailrc-deliver -&gt; ~/.scmail/deliver-rules</li>
<li>~/.scmailrc-refile -&gt; ~/.scmail/refile-rules</li>
<li>~/.scmail-log -&gt; ~/.scmail/log</li>
</ul></li>
<li>Writing a rule using lambda becomes easy.
<ul>
<li>Please see a sample code in dot.scmail/deliver-rules.sample.</li>
</ul></li>
<li>Many codes are rearranged.</li>
<li>A test suite is prepared (make check)</li>
</ul></li>
<li><em>2002-10-24</em>: <a href="#download">scmail 0.1</a> Released!</li>
</ul>

<h2>Requirements</h2>
<ul>
<li><a href="http://www.shiro.dreamhost.com/scheme/gauche/">Gauche</a> 0.7.4.1 or later</li>
</ul>

<h2>Characteristics</h2>
<ul>
<li>Written simply in Scheme.</li>
<li>spam filter <a href="scbayes.html">scbayes</a> is included. (now testing)</li>
<li>scmail supports MH and Maildir mailboxes.</li>
<li>Simple filtering rules can be written in S-expressions.</li>
<li>Advanced filtering rules can be written in Scheme programs.</li>
<li>scmail can filter an incoming mail when it is received (like procmail).</li>
<li>scmail can filter mails in a mailbox.</li>
</ul>

<h2>Installation</h2>
<p>To install scmail, run the following commands.</p>
<pre>% gzip -dc scmail-1.3.tar.gz | tar xvf - 
% cd scmail-1.3
Password: (enter root's password)
# make
# make install</pre>

<h2>Components</h2>
<ul>
<li>scmail-deliver: a command to filter an incoming mail when it is received.</li>
<li>scmail-refile: a command to filter mails in a mailbox.</li>
<li>scbayes: a command to learn spam and nonspam mails for spam filtering.</li>
</ul>

<h2>Configuration</h2>
<p>Copy a sample file (~/dot.scmail/config.sample) to ~/.scmail/config and edit
it.</p>

#{../dot.scmail/config.sample}

<h2>Using scmail-deliver</h2>
<p>scmail-deliver is a command to filter an incoming mail when it is
received. scmail-deliver uses Filtering rules defined in
~/.scmail/deliver-rules. You can copy a sample file
(dot.scmail/deliver-rules.sample) to ~/.scmail/deliver-rules.</p>
<p>If your mail server is
<a href="http://www.sendmail.org/">Sendmail</a> or
<a href="http://www.postfix.org/">Postfix</a>, you can put the
following ~/.forward file to filter an incoming mail when it
is received.</p>
<pre>| /usr/local/bin/scmail-deliver</pre>
<p>If you are using
<a href="http://www.tuxedo.org/~esr/fetchmail/">fetchmail</a> to
fetch mails from a POP server, you can add the following
code into your ~/.fetchmailrc file to use scmailrc-deliver.</p>
<pre>poll pop3.example.org
     protocol apop
     user satoru
     mda "/usr/local/bin/scmail-deliver"
     no mimedecode</pre>

<h2>Using scmail-refile</h2>
<p>scmail-refile is a command to filter mails in a mailbox.
scmail-refile uses Filtering rules defined in
~/.scmail/refile-rules. You can copy a sample file
(dot.scmail/refile-rules.sample) to ~/.scmail/refile-rules.</p>
<p>To use scmail-refile, run it on the command line like the following:</p>
<pre>% scmail-refile
refile: inbox/93 -&gt; ml/enkai&#64;coboler/57
refile: inbox/94 -&gt; ml/linux-zaurus/218
refile: inbox/98 -&gt; ml/linux-zaurus/219
refile: inbox/99 -&gt; ml/ming/42           </pre>
<p>In this example, the first line in the output messages shows a mail 93
in inbox folder is refiled to ml/enkai&#64;colber as a mail 57.
~/.scmail/log file contains the same report with time information.</p>
<pre>% tail -5 ~/.scmail/log
2002-09-26T12:49:31: refile: inbox/93 -&gt; ml/enkai&#64;coboler/57  
2002-09-26T12:49:31: refile: inbox/94 -&gt; ml/linux-zaurus/218  
2002-09-26T12:49:31: refile: inbox/98 -&gt; ml/linux-zaurus/219
2002-09-26T12:49:31: refile: inbox/99 -&gt; ml/ming/42</pre>

<h2>Filtering rules</h2>
<p>You can edit sample files.</p>

<h3>dot.scmail/deliver-rules.sample</h3>

#{../dot.scmail/deliver-rules.sample}

<h3>dot.scmail/refile-rules.sample</h3>

#{../dot.scmail/refile-rules.sample}


<h2>Using a spam filter</h2>
<p>Please see <a href="scbayes.html">scbayes's documentation</a>.</p>

<h2>FAQ</h2>

<h3>How does scmail handle a huge mail?</h3>
<p>Since scmail handles a mail on memory entirely, a huge mail
which cannot fit in memory is not supported. So,
scmail-deliver perhaps loses an incoming huge mail.</p>

<h3>What happens if a rule file has syntax errors?</h3>
<p>scmail uses rules read correctly and broken rules are ignored.
Messages of syntax errors are reported in ~/.scmail/log.</p>


<h2><a name="download" id="download">Download</a></h2>
<p>scmail is a free software with ABSOLUTELY NO WARRANTY under
so called "BSD licence".</p>
<ul>
<li><a href="http://namazu.org/~satoru/scmail/scmail-1.3.tar.gz">scmail-1.3.tar.gz</a></li>
<li><a href="http://sourceforge.net/cvs/?group_id=111001">CVS</a></li>
</ul>

<h2>References</h2>
<ul>
<li>Simon Cozens: <a href="http://simon-cozens.org/writings/mail-audit.html">Filtering Mail with Mail::Audit and News::Gateway</a>, 
    The Perl Journal, Vol. 5, No. 2. (2000)
<ul>
<li>Describing a mail filter written in Perl. 
      It starts with a strong message: "Let's face it.  procmail is horrid."</li>
</ul></li>
</ul>

<h2>Links</h2>
<ul>
<li><a href="http://www.procmail.org/">procmail</a>: 
    A popular mail filter with an abnormal syntax.</li>
<li><a href="http://www.flounder.net/~mrsam/maildrop/">maildrop</a>:
    A mail filter with a C-like syntax.</li>
<li><a href="http://www.cyrusoft.com/sieve/">Sieve</a>:
    A standard language for mail filtering. 
    Although it is an RFC, its syntax is not so good (IMHO). 
    Various implementations are available.</li>
<li><a href="http://www.ics.uci.edu/~mh/">MH</a>: 
    A traditional Unix mailer. 
    slocal command filters an incoming mail when it is received, 
    and pick and refile commands filter mails in a mailbox respectively.</li>
<li><a href="http://spamassassin.org/">spamassasin</a>: 
    A mail filter to identify spam.</li>
<li><a href="http://www.nongnu.org/ifile/">ifile</a>: 
    A machine-learning-based mail filter.</li>
<li><a href="http://www.h2.dion.ne.jp/~nabeken/bsfilter/">bsfilter</a>
    A bayesian spam filter written in Ruby.</li>
<li><a href="http://bogofilter.sourceforge.net/">Bogofilter</a>
    A bayesian spam filter written in C.</li>
<li><a href="http://yample.sourceforge.net/">Yample</a>
    Yet Another Mail Processing Language</li>
<li><a href="http://freshmeat.net/projects/scmail/">freshmeat.net: scmail</a></li>
</ul>

<hr />
<address><a href="http://namazu.org/~satoru/">Satoru Takabayashi</a></address>
</body>
</html>
