| 1 |
root |
1.1 |
## --------------------------------------------------------------------------- |
| 2 |
|
|
## $Id: .dispatchmailrc,v 1.7 2003/01/24 03:16:23 joko_mail Exp $ |
| 3 |
|
|
## --------------------------------------------------------------------------- |
| 4 |
|
|
## $Log: .dispatchmailrc,v $ |
| 5 |
|
|
## Revision 1.7 2003/01/24 03:16:23 joko_mail |
| 6 |
|
|
## + fixed 'Cron'-rule\n+ fixed 'me2myself'-rule |
| 7 |
|
|
## |
| 8 |
|
|
## Revision 1.6 2003/01/24 02:35:03 joko_mail |
| 9 |
|
|
## + modified structure (hierarchy) of IMAP folders completely (more or less) |
| 10 |
|
|
## |
| 11 |
|
|
## Revision 1.5 2003/01/24 00:58:38 joko |
| 12 |
|
|
## + added log-message at end of rules |
| 13 |
|
|
## |
| 14 |
|
|
## Revision 1.4 2003/01/24 00:45:16 joko |
| 15 |
|
|
## + used feature 'AUTOCREATE_FOLDERS' |
| 16 |
|
|
## + added new rules |
| 17 |
|
|
## + moved logs/cvs/quepasa.netfrag.org to logs/netfrag.org/cvs |
| 18 |
|
|
## |
| 19 |
|
|
## Revision 1.3 2003/01/24 00:23:40 joko |
| 20 |
|
|
## + reformatted former log-message to contain max. 80 chars per line |
| 21 |
|
|
## |
| 22 |
|
|
## Revision 1.2 2003/01/24 00:18:41 joko |
| 23 |
|
|
## + modified according to refactoring or 'recieveMail' to ' |
| 24 |
|
|
## dispatchmail' and 'Mail::Audit::Dispatch' |
| 25 |
|
|
## |
| 26 |
|
|
## --------------------------------------------------------------------------- |
| 27 |
|
|
|
| 28 |
|
|
|
| 29 |
|
|
package rules; |
| 30 |
|
|
|
| 31 |
|
|
use strict; |
| 32 |
|
|
# don't use warnings; |
| 33 |
|
|
|
| 34 |
|
|
my $mc = 0; |
| 35 |
|
|
sub mark { |
| 36 |
|
|
$mc++; |
| 37 |
|
|
#report("mark $mc"); |
| 38 |
|
|
} |
| 39 |
|
|
|
| 40 |
|
|
sub dispatch { |
| 41 |
|
|
|
| 42 |
|
|
# --- for dispatchmail (not needed with receiveMail) |
| 43 |
|
|
my $self = shift; |
| 44 |
|
|
my $incoming = $self->{incoming}; |
| 45 |
|
|
my $MAILDIR = $self->{settings}->{MAILDIR}; |
| 46 |
|
|
|
| 47 |
|
|
# --- recieveMail (relicts) - TODO: refactor this! |
| 48 |
|
|
my $from = $incoming->from; |
| 49 |
|
|
my $to = $incoming->to; |
| 50 |
|
|
my $subject = $incoming->subject; |
| 51 |
|
|
chomp($from); |
| 52 |
|
|
chomp($to); |
| 53 |
|
|
chomp($subject); |
| 54 |
|
|
|
| 55 |
|
|
#report("MAILDIR: $MAILDIR"); |
| 56 |
|
|
|
| 57 |
|
|
# --- dispatchmail - additional options |
| 58 |
|
|
|
| 59 |
|
|
# enable this to let dispatchmail create your target folders on demand |
| 60 |
|
|
$self->{settings}->{AUTOCREATE_FOLDERS} = 1; |
| 61 |
|
|
|
| 62 |
|
|
|
| 63 |
|
|
# ----- |
| 64 |
|
|
# subject-based-routing |
| 65 |
|
|
|
| 66 |
|
|
$self->jaccept("$MAILDIR/FILTERED/Spam") |
| 67 |
|
|
if ($subject =~ /^{SPAM\?}/); |
| 68 |
|
|
$self->jaccept("$MAILDIR/FILTERED/Spam") |
| 69 |
|
|
if ($from =~ /fminfos\@web\.de/); |
| 70 |
|
|
|
| 71 |
|
|
if ($subject =~ /h1 .+ ACTIVE SYSTEM ATTACK!/) { |
| 72 |
|
|
$self->jaccept("$MAILDIR/SORTED/logs/netfrag.org/system/h1.service.netfrag.org"); |
| 73 |
|
|
} |
| 74 |
|
|
if ($subject =~ /Automated notification of topic changes/) { |
| 75 |
|
|
$self->jaccept("$MAILDIR/SORTED/logs/twiki.org/ChangeLog"); |
| 76 |
|
|
} |
| 77 |
|
|
if ($subject =~ /remember/i || $subject =~ /!$/) { |
| 78 |
|
|
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Inbox"); |
| 79 |
|
|
} |
| 80 |
|
|
|
| 81 |
|
|
# ---------------------------------------- |
| 82 |
|
|
# source-routing - admin emails |
| 83 |
|
|
if ($incoming->from =~ /(root|admin)\@quepasa\.netfrag\.org/i) { |
| 84 |
|
|
$self->jaccept("$MAILDIR/SORTED/logs/netfrag.org/system/quepasa.netfrag.org"); |
| 85 |
|
|
} |
| 86 |
|
|
if ($incoming->from =~ /(root|service|netsaint)\@h1\.service\.netfrag\.org/i) { |
| 87 |
|
|
$self->jaccept("$MAILDIR/SORTED/logs/netfrag.org/system/h1.service.netfrag.org"); |
| 88 |
|
|
} |
| 89 |
|
|
|
| 90 |
|
|
mark(); |
| 91 |
|
|
|
| 92 |
|
|
|
| 93 |
|
|
mark(); |
| 94 |
|
|
|
| 95 |
|
|
# ---------------------------------------- |
| 96 |
|
|
# destination-routing - mailing-lists |
| 97 |
|
|
|
| 98 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/archivists-talk") |
| 99 |
|
|
if $to =~ /archivists-talk\@yahoogroups\.com/; |
| 100 |
|
|
|
| 101 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/poop") |
| 102 |
|
|
if $to eq 'poop-group@lists.sourceforge.net'; |
| 103 |
|
|
|
| 104 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/pear-dev") |
| 105 |
|
|
if $to eq 'pear-dev@lists.php.net'; |
| 106 |
|
|
|
| 107 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/twiki-dev") |
| 108 |
|
|
if $to eq 'twiki-dev@lists.sourceforge.net'; |
| 109 |
|
|
|
| 110 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/misc") |
| 111 |
|
|
if $self->compareTarget('\@lists\.sourceforge\.net'); |
| 112 |
|
|
|
| 113 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/xml-dbms") |
| 114 |
|
|
if $self->compareTarget('xml-dbms\@yahoogroups\.com'); |
| 115 |
|
|
|
| 116 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/mapi-l") |
| 117 |
|
|
if $self->compareTarget('MAPI-L\@PEACH\.EASE\.LSOFT\.COM'); |
| 118 |
|
|
|
| 119 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/kroupware") |
| 120 |
|
|
if $self->compareTarget('kroupware\@mail\.kde\.org'); |
| 121 |
|
|
|
| 122 |
|
|
mark(); |
| 123 |
|
|
|
| 124 |
|
|
|
| 125 |
|
|
# ---------------------------------------- |
| 126 |
|
|
# destination-routing - log-messages (logs) |
| 127 |
|
|
|
| 128 |
|
|
$self->jaccept("$MAILDIR/SORTED/logs/netfrag.org/cvs") |
| 129 |
|
|
if $subject =~ m/^cvs-log: /; |
| 130 |
|
|
$self->jaccept("$MAILDIR/SORTED/logs/netfrag.org/cvs") |
| 131 |
|
|
if $subject =~ m/^\[CVS (.+?)\]/; |
| 132 |
|
|
$self->jaccept("$MAILDIR/SORTED/logs/netfrag.org/joko/cron") |
| 133 |
|
|
if $subject =~ m/^Cron <(joko|joko_mail)\@quepasa.*>.*$/; |
| 134 |
|
|
$self->jaccept("$MAILDIR/SORTED/logs/netfrag.org/system/applications") |
| 135 |
|
|
if $subject =~ m/quepasa daily usenet report/; |
| 136 |
|
|
|
| 137 |
|
|
|
| 138 |
|
|
# ---------------------------------------- |
| 139 |
|
|
# source && destination - routing |
| 140 |
|
|
if ( |
| 141 |
|
|
$incoming->from =~ /andreas\.motl\@ilo\.de/ |
| 142 |
|
|
|| |
| 143 |
|
|
$incoming->from =~ /joko.*\@netfrag\.org/ |
| 144 |
|
|
&& |
| 145 |
|
|
$self->compareTarget('joko\@.*netfrag\.org') |
| 146 |
|
|
) { |
| 147 |
|
|
$self->jaccept("$MAILDIR/SORTED/me2myself"); |
| 148 |
|
|
} |
| 149 |
|
|
|
| 150 |
|
|
# ---------------------------------------- |
| 151 |
|
|
# source-routing - newsletters |
| 152 |
|
|
|
| 153 |
|
|
$self->jaccept("$MAILDIR/SORTED/lists/newsletters") |
| 154 |
|
|
if $from =~ /newsletter/; |
| 155 |
|
|
|
| 156 |
|
|
# ---------------------------------------- |
| 157 |
|
|
# destination-routing - prio 1 |
| 158 |
|
|
|
| 159 |
|
|
$self->jaccept("$MAILDIR/SORTED/ilo.de/Inbox") |
| 160 |
|
|
if ($self->compareTarget('andreas\.motl\@ilo\.de')); |
| 161 |
|
|
|
| 162 |
|
|
$self->jaccept("$MAILDIR/SORTED/netfrag.org/Inbox") |
| 163 |
|
|
if ($self->compareTarget('joko\@.*netfrag\.org')); |
| 164 |
|
|
|
| 165 |
|
|
if ($incoming->to =~ /web\.de/i) { |
| 166 |
|
|
$self->jaccept("$MAILDIR/SORTED/web.de/Current/Inbox"); |
| 167 |
|
|
} |
| 168 |
|
|
|
| 169 |
|
|
# wor.net mailbox removed on 2002-11-13 |
| 170 |
|
|
#if ($incoming->to =~ /wor\.net/i) { |
| 171 |
|
|
# $self->jaccept("$MAILDIR/SORTED/wor.net/Current/Inbox"); |
| 172 |
|
|
#} |
| 173 |
|
|
|
| 174 |
|
|
mark(); |
| 175 |
|
|
|
| 176 |
|
|
# ---------------------------------------- |
| 177 |
|
|
# destination-routing - prio 2 |
| 178 |
|
|
|
| 179 |
|
|
my $bool_ilo = ($incoming->to =~ m/ilo\.de/i); |
| 180 |
|
|
my $bool_ilo_news1 = ($incoming->to =~ m/kritletter\@kbx\.de/i); |
| 181 |
|
|
my $bool_from_kolumnen_de = ($incoming->to =~ m/kolumnen\.de/i); |
| 182 |
|
|
my $bool_from_strixner = ($incoming->to =~ m/strixner\@web\.de/i); |
| 183 |
|
|
if ($bool_ilo || $bool_ilo_news1 || $bool_from_kolumnen_de || $bool_from_strixner) { |
| 184 |
|
|
$self->jaccept("$MAILDIR/SORTED/ilo.de/Inbox"); |
| 185 |
|
|
} |
| 186 |
|
|
|
| 187 |
|
|
#report("end of dispatcher"); |
| 188 |
|
|
|
| 189 |
|
|
$self->report("STATUS: No rule applied, ACCEPT using default TARGET."); |
| 190 |
|
|
$self->jaccept("$MAILDIR/SORTED/misc/Inbox"); |
| 191 |
|
|
|
| 192 |
|
|
} |
| 193 |
|
|
|
| 194 |
|
|
1; |