--- nfo/perl/scripts/dispatchmail/bin/dispatchmail 2003/01/22 05:07:56 1.1 +++ nfo/perl/scripts/dispatchmail/bin/dispatchmail 2003/01/22 05:38:44 1.2 @@ -1,59 +1,20 @@ #!/usr/bin/perl -# ========================================================================== +# ============================================================ # -# recieveMail v0.04 -# a simple mail filter done in perl with CPAN-module "Mail::Audit" +# dispatchmail v0.05 +# A simple mail filter done in perl +# with the Perl-module "Mail::Audit" +# available from CPAN. # +# $Id: dispatchmail,v 1.2 2003/01/22 05:38:44 collector Exp $ # -# 2002-11-09, joko@netfrag.org -# + recieveMail now can run globally (/etc/mail/smrsh!) -# + $HOME is taken from $ENV{HOME} or $ENV{PWD} -# + rules are taken from $HOME/Mail/.rules.pm -# + fallback mechanism(s) -# + bugfixes -# -# 2002-10-14, joko@netfrag.org -# + $LOGFILE is used now (recievemail.log) -# + tracing (uses $LOGFILE) -# + checks delivery path for existance, -# changes $LOGFILE if needed -# -# 2002-07-17, joko@netfrag.org -# + added filtering by target (destination-routing) -# (looks in "to", "cc" and "bcc") -# -# 2001-12-05, joko@netfrag.org -# + initial internal release -# -# -# TODO: -# - more sophisticated filtering -# - configuration-comfort (use perl-arrays and -hashes for rule-declaration) -# - Html-Gui to add/edit/remove rules -# - rule base located in LDAP (local delivery routing) -# - completely hide away regex-stuff and provide simpler wildcarding -# - hide needed quoting of dots (.) and ats (@) in addresses -# - provide: beginsWith(string), endsWith(string), beginsAt(string, pos|regex) -# - this could become a CPAN-module sometimes (?): -# - "String"-Object to be inherited from gives these methods to you -# - examples: -# - routeTo("mbox:/path/to/mbox") if $to->beginsWith("hello"); -# - routeTo("fax:+4930123456") if $subject->contains("gatefax"); -# - metadata: -# - add some info about the context we are running in: -# - console -# - sendmail/normal -# - sendmail/smrsh -# - add some info about the user we are doing this for: -# - username -# - home-directory -# -# WISHLIST: -# - format basic log-output similar to procmail.log -# - introduce some "extended logging" including the chosen routing path +# ============================================================ +# $Log: dispatchmail,v $ +# Revision 1.2 2003/01/22 05:38:44 collector +# + prepared refactoring to 'dispatchmail' # -# ========================================================================== +# ============================================================ use strict; # don't use warnings; @@ -90,7 +51,7 @@ my $HOME = $opt_base; my $MAILDIR = "$HOME/Mail"; my $LOGFILE = "$MAILDIR/recievemail.log"; -my $RULESFILE = "$MAILDIR/.rules.pm"; +my $RULESFILE = "$HOME/.recievemailrc.pm"; my $LOCKFILE = "$HOME/.procmail.lockfile"; my $DEFAULT = "$MAILDIR/Inbox"; my $DEBUG = 0; @@ -113,6 +74,7 @@ # 0.a. pre flight tracing if ($TRACE) { + s2f("-" x 80); s2f("Mail from " . gchomp($incoming->from) . " to " . gchomp($incoming->to)); s2f("Subject: " . gchomp($incoming->subject)); }