host1:~lace/src/PerlMail/ update.
[PerlMail.git] / PerlMail / Config.pm
1 #! /usr/bin/perl
2
3 #       $Id: Config.pm,v 1.9.2.27 2010/07/16 07:17:42 lace Exp $
4 # Copyright (C) 2002-2003 Jan Kratochvil <project-PerlMail@jankratochvil.net>
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20
21 package PerlMail::Config;
22 use vars qw($VERSION);
23 $VERSION=do { my @r=(q$Revision: 1.9.2.27 $=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
24 use strict;
25 use warnings;
26
27 require Exporter;
28 use vars qw(@ISA @EXPORT);
29 @ISA=qw(Exporter);
30 @EXPORT=qw(
31                 $HOME
32                 $Mail $Mail2 @ValidUsers $IdleMax $MaxBodySMS @SMSwebRcpt $SMSwebRcpt_username
33                 $Lock_pathname $PeerAddr $Socket_timeout $DB_table $DBI_database $DBI_user $DBI_pwd
34                 $clamscan_waitpid_timeout
35                 $sendmail_orig @addr_addon &FromAddress @h_rcpt @h_from
36                 %audit_profile @sms_squeezes @alternates_host @dnsbl_whitelist
37
38                 $Audit $is_pgp $opt_F $procmailFROM_MAILER $store_ignore $store_ignorenewmail
39                 $store_profile
40                 );
41
42 require Mail::Alias;
43 require MIME::Words;
44 use Carp qw(confess cluck);
45
46
47 BEGIN {
48         for (qw(headerhas writeto store headeris did dnsbl store_muttrc_alternates Received_for parts_linear mime_type
49                         body_first body_simple is_multipart mimehead mimebody spamassassin clamscan header_remap)) {
50                 eval 'sub '.$_.' { return ::'.$_.'(@_); }';
51                 }
52         }
53
54
55 # perlmail-accept & perlmail-sendmail
56
57 # Various configuration files location is derived from it:
58 our $HOME="/home/lace";
59
60
61 # perlmail-accept
62
63 # Mail folder:
64 our $Mail="$HOME/Mail";
65 our $Mail2="/home/lacemail/Mail";
66 # Users respected for the 'idle' state (see $IdleMax):
67 our @ValidUsers=qw(root lace short kratochvil _local);
68 # Maximum number of local console idle seconds while still considered as 'active user':
69 our $IdleMax=10;
70 # Maxium number of bytes to pass to Lingua::EN::Squeeze (performance optimization):
71 our $MaxBodySMS=0x1000;
72 # Telephone number to send SMSes by WWW::SMS to:
73 our @SMSwebRcpt=qw(420 602 431329);
74 # Some WWW::SMS modules require username:
75 our $SMSwebRcpt_username="lace2";
76 our $clamscan_waitpid_timeout=3;
77
78
79 # perlmail-submit
80
81 # Global system lock for exclusive $DB_table access:
82 our $Lock_pathname="/tmp/PerlMail.lock";
83 # 'workstation' hostname and port. Hostname may be dyndns:
84 our $PeerAddr="kashome.dyn.jankratochvil.net.:852";
85 #our $PeerAddr="127.0.0.1:2852";
86 # 15sec is NOT enough as the remote peer must complete mail store:
87 our $Socket_timeout=7600;
88 # MySQL table name:
89 our $DB_table="PerlMail_folder";
90 # MySQL database name:
91 our $DBI_database="short";
92 # MySQL user name:
93 our $DBI_user="short";
94 # MySQL user password:
95 our $DBI_pwd=$HOME."/priv/mysql.".$DBI_user.".pwd";
96
97
98 # perlmail-sendmail
99
100 # Lists where <rcpt-USER.AT.HOST@jankratochvil.net> address is generated:
101 my @lists=qw(
102                 tacplus-l@disaster.com
103                 gsm@sh.cvut.cz
104                 n9k@pandora.cz
105                 dev9k@pandora.cz
106                 gsm@pandora.cz
107                 ros-general@reactos.com
108                 ros-kernel@reactos.com
109                 ros-dev@reactos.com
110                 ros-cvs@reactos.com
111                 4cinfo@atrey.karlin.mff.cuni.cz
112                 libtool@gnu.org
113                 libtool-patches@gnu.org
114                 wine-license@winehq.org
115                 gtk-devel-list@gnome.org
116                 gnome-vfs-list@gnome.org
117                 captive-announce-list@jankratochvil.net
118                 captive-list@jankratochvil.net
119                 captive-devel-list@jankratochvil.net
120                 linux-ntfs-announce@lists.sourceforge.net
121                 linux-ntfs-dev@lists.sourceforge.net
122                 orbit-list@gnome.org
123                 devel@kannel.org
124                 automake@gnu.org
125                 autoconf@gnu.org
126                 autoconf-patches@gnu.org
127                 wget-patches@sunsite.dk
128                 wget@sunsite.dk
129                 wineconf@winehq.org
130                 prague-pm@pm.org
131                 dev@httpd.apache.org
132                 asterisk-perl@lists.gnuinter.net
133                 isdn4linux@listserv.isdn4linux.de
134                 libc-alpha@sources.redhat.com
135                 squid-dev@squid-cache.org
136                 );
137                 #4c-list@vellum.cz
138
139 # Pathname of the original sendmail(8) binary:
140 our $sendmail_orig=(-x ($_="/usr/sbin/sendmail-orig") ? $_ : "/usr/sbin/sendmail");
141 # List of addresses to locally Bcc all mails to:
142 # Mail-Alias-1.12 defaults to "/etc/mail/aliases" which does not exist on RedHat sendmail-8.12.5-7
143 # Mail-Alias-1.12 will clutter $_ !
144 our @addr_addon=(Mail::Alias->new("/etc/aliases")->exists("sentout") ? ("sentout") : ());
145
146 our $opt_F;     # imported
147 our $is_pgp;    # imported
148 my %lists=map(($_=>1),@lists);
149 # Generate new From address for the target $rcpt of type Mail::Address.
150 # $iserror is true for "MAIL FROM" RFC821 address, false for "From:" RFC822 address.
151 # Returns: Mail::Address instance.
152 sub FromAddress
153 {
154 my($rcpt,$iserror)=@_;
155
156         my $phrase=(defined $opt_F ? $opt_F : "Jan Kratochvil");
157         {
158                 last if !$is_pgp;
159                 last if $iserror;
160                 local *F;
161                 local $_;
162                 my $filename="$HOME/.gnupg/options";
163                 open F,$filename or do { warn "Open \"$filename\": $!"; last; };
164                 local $/="\n";
165                 my @keys=map((/^\s*default-key\s+(\S+)\s*$/),<F>);
166                 @keys==1 or do { warn "Found ".scalar(@keys)." 'default-key's in your \"$filename\", ignoring"; last; };
167                 close F or warn "Close \"$filename\": $!";
168                 my $default_key=$keys[0];
169                 $default_key=~/^[[:xdigit:]]{8}$/ or do { warn "Invalid 'default-key', ignoring: $default_key"; last; };
170                 return Mail::Address->new(
171                                 $phrase,
172                                 'pgp-'.uc($default_key).'@jankratochvil.net',
173                                 );
174                 }
175         return Mail::Address->new($phrase,'lace@jankratochvil.net') if !$lists{$rcpt->address()};
176         return Mail::Address->new(
177                         $phrase,
178                         'rcpt'
179                                         .'-'
180                                         .(defined($rcpt->user()) ? $rcpt->user() : "NOUSER")
181                                         .".AT."
182                                         .(defined($rcpt->host()) ? $rcpt->host() : "LOCAL")
183                                         .'@jankratochvil.net',
184                         );
185 }
186
187 # RedHat sendmail-8.9.3-20/src/conf.c/HdrInfo[]/\Q/* destination fields */\E
188 # FIXME: Recognize "Resent-$_" headers for -t but when we are in 'resent' mode?
189 our @h_rcpt=(   # case in-sensitive!
190                 "To",
191                 "Cc",
192                 "Bcc",
193                 "Apparently-To",
194                 );
195 # ordering matters; first header found is substituted
196 # last header is subsituted if no one is found
197 our @h_from=(
198                 "Resent-From",
199                 "From",
200                 );
201
202
203 # My-Audit
204
205 # Setup profile names.
206 # First element of /^=/ form copies it referenced profile to be extended.
207 # 'did'    =>did() subroutine will return true for it.
208 # 'syslog' =>Use syslog(3).
209 # 'bell'   =>Bell sound.
210 # 'sms=\d+'=>Send SMS by WWW::SMS with specified maximum # of parts
211 our %audit_profile=(
212                 "btw"   =>["syslog"],
213                 "silent"=>["=btw"   ,"did"],
214                 "log"   =>["=silent","syslog"],
215                 "bell"  =>["=log"   ,"bell"],
216                 "sms"   =>["=bell"  ,"sms=1"],
217                 "crit"  =>["=sms"   ,"sms=3"],
218                 );
219 # Try the squeezing methods in this order:
220 our @sms_squeezes=(
221                 { "SqueezeControl"=>"noconv"                         },
222                 { "SqueezeControl"=>"conv"  ,"SQZ_OPTIMIZE_LEVEL"=>0 },
223                 { "SqueezeControl"=>"conv"  ,"SQZ_OPTIMIZE_LEVEL"=>1 },
224                 { "SqueezeControl"=>"med"   ,"SQZ_OPTIMIZE_LEVEL"=>0 },
225                 { "SqueezeControl"=>"med"   ,"SQZ_OPTIMIZE_LEVEL"=>1 },
226                 { "SqueezeControl"=>"max"   ,"SQZ_OPTIMIZE_LEVEL"=>0 },
227                 { "SqueezeControl"=>"max"   ,"SQZ_OPTIMIZE_LEVEL"=>1 },
228                 );
229 # Hostnames where we had alternate e-mail addresses:
230 our @alternates_host=(
231                 "jabberwock.ucw.cz",    # short@ucw.cz
232                 "atrey.karlin.mff.cuni.cz",     # short@atrey.karlin.mff.cuni.cz
233                 "k332.feld.cvut.cz",    # short@k332.feld.cvut.cz
234                 );
235 # Override DNS blacklists:
236 our @dnsbl_whitelist=(
237                 "195.250.128.83",       # smtp3.vol.cz; vol.cz.multistage.blackholes.five-ten-sg.com.
238                 "64.49.222.22",         # mail.pm.org: rackspace.com.spam-support.blackholes.five-ten-sg.com.
239                 "208.147.243.5",        # gambit.liquidcomm.net: cw.net.spam-support.blackholes.five-ten-sg.com.
240                 "213.235.135.70",       # smtp.tiscali.cz: tiscali.cz.multistage.blackholes.five-ten-sg.com.
241                 "205.139.198.11",       # eniac.disaster.com: cw.net.spam-support.blackholes.five-ten-sg.com.
242                 "127.0.0.2",                    # 2.0.0.127.relays.ordb.org.
243                 "65.113.40.131",        # bozo.vmware.com: qwest.net.spam-support.blackholes.five-ten-sg.com.
244                 "66.218.85.33",         # mta2.wss.scd.yahoo.com: yahoo.com.spam.blackholes.five-ten-sg.com.
245                 "212.80.76.42",         # mx2.seznam.cz: seznam.cz.free.blackholes.five-ten-sg.com.
246                 "64.110.204.63",        # hsdbrg64-110-204-63.sasknet.sk.ca: 64.110.202.181.sasknet.sk.ca.misc.spam.blackholes.five-ten-sg.com.
247                 "212.80.76.44",         # mx1.seznam.cz: 44.76.80.212.blackholes.five-ten-sg.com.
248                 "212.80.76.29",         # prace.seznam.cz: 212.80.76.42.seznam.cz.free.blackholes.five-ten-sg.com
249                 "193.252.22.30",        # smtp1.wanadoo.fr: 30.22.252.193.blackholes.five-ten-sg.com
250                 "213.151.87.16",        # posta.dobnet.cz: 16.87.151.213.relays.ordb.org
251                 );
252
253 #sub dolist
254 #{
255 #       my($list)=@_;
256 #
257 #       my $mailed=0;
258 #       for my $alias ("",qw(admin bounces confirm join leave owner request subscribe unsubscribe)) {
259 #               my $head=$list.($alias?"-$alias":"");
260 #               my $mail=$head.'@jankratochvil.net';
261 #               if (headerhas("To",$mail)||headerhas("Cc",$mail)) {
262 #                       writeto "|sudo -u mailman /usr/lib/mailman/mail/mailman ".($alias||"post")." $list";
263 #                       #writeto "|/usr/local/bin/mailmanlace ".($alias||"post")." $list";
264 #                       ###writeto "|/usr/sbin/sendmail $head".'@localhost.localdomain';
265 #                       $mailed++;
266 #               }
267 #       }
268 #       return $mailed;
269 #}
270
271 our $Audit;     # imported
272 our $procmailFROM_MAILER;       # imported
273 our $store_ignorenewmail;       # imported
274 our $store_profile;     # imported
275 our $store_ignore;      # imported
276 sub audit
277 {
278         $store_profile=undef();
279
280         # never spawn new mail if FROM_MAILER
281         # $isFROM_MAILER postponed after maillists as they may look as FROM_MAILER
282         #use re 'debug';
283         my $isFROM_MAILER=$Audit->header()=~/$procmailFROM_MAILER/mio;
284         $store_ignorenewmail=(0
285                         || $isFROM_MAILER
286                         || headerhas "From",'<Regexp:^owner->'
287                         );
288
289         return if did sub { store "=spy","log" if headeris "From",'<spy@jankratochvil.net>'; };
290
291         return if did sub { store "=hotelgatespam","log" if headeris("To",'<postmaster@hotelgate.hotelnet>'); };
292
293         # whitelist
294         my $whitelist;
295         $whitelist||=headeris("From",'<amapi11@seznam.cz>');
296         $whitelist||=headeris("From",'<llucie0@seznam.cz>');
297         $whitelist||=headeris("From",'<aaaanetka@seznamka.cz>');
298         $whitelist||=headeris("From",'<luciseksieber@centrum.cz>');
299         $whitelist||=headeris("From",'<lagica@azet.sk>');
300         $whitelist||=headeris("From",'<robot@alza.cz>');
301         $whitelist||=headeris("From",'<peters.al@atlas.cz>');
302         $whitelist||=headeris("From",'<peters.also@gmail.com>');
303         $whitelist||=headeris("From",'<ceskaposta@cpost.cz>');  # HTML
304         $whitelist||=headeris("From",'<noreply@alza.cz>');      # HTML
305         $whitelist||=headeris("From",'<eshop@barvic-novotny.cz>');      # HTML
306         $whitelist||=headeris("From",qr/@(?:)equabank\.cz$/);
307         $whitelist||=headeris("From",'<noreply@firma.seznam.cz>');
308         $whitelist||=headeris("From",'<help@interactivebrokers.com>');
309         $whitelist||=headeris("From",'<no-reply@mailer.idnes.cz>');     # HTML
310         $whitelist||=headeris("From",'<noreply@financnik.cz>'); # HTML
311         $whitelist||=headeris("Return-Path",'<doklady@alza.cz>');       # HTML
312         $whitelist||=headeris("Return-Path",'<jan.kolar@jklabs.cz>');
313         $whitelist||=headeris("Return-Path",'<rexstevie@gmail.com>');
314         $whitelist||=headeris("Return-Path",'<info@eon.cz>');
315         $whitelist||=headeris("Return-Path",'<webinfo@info.alza.cz>');
316         $whitelist||=headeris("Return-Path",'<robot@3-e.cz>');
317         $whitelist||=headeris("Return-Path",'<info@levneelektro.cz>');
318         $whitelist||=headeris("Return-Path",'<sluzebnicek@info.alza.cz>');      # HTML
319         $whitelist||=headeris("Return-Path",'<info@alza.cz>');  # HTML
320         $whitelist||=headeris("Return-Path",'<onlinebanking@zuno.cz>'); # HTML
321         $whitelist||=headeris("Return-Path",'<epujcky@rb.cz>'); # HTML
322         $whitelist||=headeris("Return-Path",'<3-e@3-e.cz>');    # HTML
323         $whitelist||=headeris("Return-Path",'<rezervaceletenek@studentagency.cz>');     # HTML
324         $whitelist||=headeris("Return-Path",'<viadiva9@yandex.ru>');
325         $whitelist||=headeris("Return-Path",'<mobilsmart@mobilsmart.cz>');      # HTML
326         $whitelist||=headeris("Return-Path",'<info@digi-hity.cz>');     # HTML
327         $whitelist||=headeris("Return-Path",'<fakturace@ampermarket.cz>');      # HTML
328         $whitelist||=headeris("Return-Path",'<info@ampermarket.cz>');   # HTML
329         $whitelist||=headeris("From",'<imc@myworkday.com>');    # HTML
330         $whitelist||=headeris("From",'<info@hledamsponzora.cz>');       # HTML
331         $whitelist||=headeris("From",'<info@hledammilionare.cz>');      # HTML
332         $whitelist||=headeris("Return-Path",'<pojisteni@axa-assistance.cz>');   # HTML
333         $whitelist||=headeris("Return-Path",'<info@axa-assistance.cz>');        # HTML
334         $whitelist||=headeris("Return-Path",'<ipus@axa-assistance.cz>');        # HTML
335         $whitelist||=headeris("Return-Path",'<letenkyonline@studentagency.cz>');        # HTML
336         $whitelist||=headeris("Return-Path",'<padi@padidiver.com>');    # HTML
337         $whitelist||=headeris("Return-Path",'<gosupport@fontai.com>');  # HTML =goparking.cz
338         $whitelist||=headeris("Return-Path",'<webmaster@obchody24.cz>');        # HTML
339         $whitelist||=headeris("Return-Path",'<info@obchody24.cz>');     # HTML
340         $whitelist||=headeris("Return-Path",'<info@levneucebnice.cz>'); # HTML
341         $whitelist||=headeris("Return-Path",'<info@povleceni-pro.cz>'); # HTML
342         $whitelist||=headeris("Return-Path",'<serviceuk@bluenile.co.uk>');      # HTML
343         $whitelist||=headeris("Return-Path",'<@bluenile.co.uk>');       # HTML - just to be sure
344         $whitelist||=headeris("Return-Path",'<ebay@ebay.com>'); # HTML
345         $whitelist||=headeris("Return-Path",'<ebay@ebay.co.uk>');       # HTML
346         $whitelist||=headeris("Return-Path",'<member@ebay.com>');       # HTML
347         $whitelist||=headeris("Return-Path",'<@members.ebay.co.uk>');   # HTML
348         $whitelist||=headeris("From",'<budget@e.budget.com>');  # HTML
349         $whitelist||=headeris("Return-Path",'<support@dhl.com>');       # HTML
350         $whitelist||=headeris("Return-Path",'<robot@prijemny-dum.cz>'); # HTML
351         $whitelist||=headeris("From",'<info@suntech.cz>');      # HTML
352         $whitelist||=headeris("From",'<obchod@kuptotu.cz>');    # HTML
353         $whitelist||=headeris("Return-Path",'<helpdesk@kolikmam.cz>');  # HTML
354         $whitelist||=headeris("From",'<servis@pneuhnidek.cz>'); # HTML
355         $whitelist||=headeris("Return-Path",'<mojeo2@o2.cz>');  # HTML
356         $whitelist||=headeris("From",'<forum@o2.cz>');  # HTML
357         $whitelist||=headeris("Return-Path",'<Klient@csobpoj.cz>');     # HTML
358         $whitelist||=headeris("Return-Path",'<info@skrivanek.cz>');     # HTML
359         $whitelist||=headeris("Return-Path",'<mail@kupshop.cz>');       # HTML
360         $whitelist||=headeris("Return-Path",'<info@erotickepomucky.net>');      # HTML
361         $whitelist||=headeris("From",'<prodej@itage.cz>');      # HTML
362         $whitelist||=headeris("Return-Path",'<obchod@elektrochram.cz>');        # HTML
363         $whitelist||=headeris("Return-Path",'<hypotecni.zona@hypotecnibanka.cz>');      # HTML
364         $whitelist||=headeris("Return-Path",'<info@ab-com.cz>');        # HTML
365         $whitelist||=headeris("Return-Path",'<sluzebnicek@alza.cz>');   # HTML
366         $whitelist||=headeris("Return-Path",'<obchod@alza.cz>');        # HTML
367         $whitelist||=headeris("Return-Path",'<registrace@alza.cz>');    # HTML
368         $whitelist||=headeris("From",'<noreply@booking.com>')   # HTML
369                    &&headeris("To",'<lace.kratochvil@gmail.com>');
370         $whitelist||=headeris("Return-Path",'<rezervace@hotel.cz>');    # HTML
371         $whitelist||=headeris("Return-Path",'<mvitousova@seznam.cz>');  # HTML
372         $whitelist||=headeris("From",'<email.campaign@sendgrid.net>');  # HTML booking.com
373         $whitelist||=headeris("Return-Path",'<@prikryvky.cz>'); # HTML
374         $whitelist||=headeris("Return-Path",'<@members.ebay.com.hk>');  # HTML
375         $whitelist||=headeris("Return-Path",'<eshop@softcom.cz>');      # HTML
376         $whitelist||=headeris("Return-Path",'<@hypotecnibanka.cz>');    # HTML
377         $whitelist||=headeris("Return-Path",'<webmaster@skveleceny.cz>');       # HTML
378         $whitelist||=headeris("Return-Path",'<member@notice.alibaba.com>');     # HTML
379         $whitelist||=headeris("From",'<no-reply@floorplanner.com>');    # HTML
380         $whitelist||=headeris("From",'<@tesla.com>');   # HTML
381         $whitelist||=headeris("Return-Path",'<noreply@e-petice.cz>');   # HTML
382         $whitelist||=headeris("Return-Path",'<delivery@bounce.indiegogo.com>'); # sometimes HTML
383         $whitelist||=headeris("Return-Path",'<survey-noreply@lr.surveymonkeyuser.com>');        # HTML, from indiegogo
384         $whitelist||=headeris("Return-Path",'<noreply@csobleasing.cz>');        # HTML
385         $whitelist||=headeris("From",'<info@leasingservis.cz>');        # HTML
386         $whitelist||=headeris("Return-Path",'<news@dimension.cz>');     # HTML
387         $whitelist||=headeris("Return-Path",'<no-reply@3-e.cz>');       # HTML
388         $whitelist||=headeris("Return-Path",'<@bounce.emails.tesla.com>');      # HTML
389         $whitelist||=headeris("Return-Path",'<@uptimerobot.com>');      # HTML
390         $whitelist||=headeris("Return-Path",'<portal.no-reply@mnd.cz>');        # HTML
391         $whitelist||=headeris("Return-Path",'<obchod@elektrometal.cz>');        # HTML
392         $whitelist||=headeris("Return-Path",'<no-reply@rl.cz>');        # HTML
393         $whitelist||=headeris("Return-Path",'<info@ecolor.cz>');        # HTML
394         $whitelist||=headeris("From",'<payments@comgate.cz>');  # HTML
395         $whitelist||=headeris("Return-Path",'<web@coi.cz>');    # HTML
396         $whitelist||=headeris("Return-Path",'<secomp@secomp.cz>');      # HTML
397         $whitelist||=headeris("Return-Path",'<info@vekra.cz>'); # HTML
398         $whitelist||=headeris("From",'<no-reply@account.wuuklabs.net>');        # HTML
399         $whitelist||=headeris("Return-Path",'<@studentagency.cz>');     # HTML
400         $whitelist||=headeris("Return-Path",'<info@csobpoj.cz>');       # HTML
401         $whitelist||=headeris("From",'<info@fera24.cz>');       # HTML
402         $whitelist||=headeris("Return-Path",'<mojebanka@kb.cz>');       # HTML
403         $whitelist||=headeris("From",'<@transferwise.com>');    # HTML
404         $whitelist||=headeris("Return-Path",'<registration@gmcac.ph>'); # HTML
405         $whitelist||=headeris("From",'<info@e-kondomy.cz>');    # HTML
406         $whitelist||=headeris("From",'<no-reply@xe.com>');      # HTML
407         $whitelist||=headeris("Return-Path",'<info@przelewy24.pl>');    # HTML
408         $whitelist||=headeris("Return-Path",'<notifikace@eidentita.cz>');       # HTML
409         $whitelist||=headeris("Return-Path",'<podpis@bezdodavatele.cz>');       # HTML
410         $whitelist||=headeris("Return-Path",'<drezybaterienew@computing-sites.eu>');    # HTML
411         $whitelist||=headeris("Return-Path",'<service@bluenile.com>');  # HTML
412         $whitelist||=headeris("From",'<@domain.com>');  # HTML; seen only <noreply@domain.c>
413         $whitelist||=headeris("From",'<objednavky@echemie.cz>');        # HTML
414         $whitelist||=headeris("Return-Path",'<noreply@datart.cz>');     # HTML
415         $whitelist||=headeris("From",'<system.eu@notice.2.ismartlife.me>');     # HTML
416         $whitelist||=headeris("Return-Path",'<suse@myworkday.com>');    # HTML
417         $whitelist||=headeris("Return-Path",'<no-reply@microsoft.com>');        # HTML
418         $whitelist||=headeris("Return-Path",'<noreply@gasnet.cz>');     # HTML
419         $whitelist||=headeris("Return-Path",'<@google.com>');   # HTML
420         $whitelist||=headeris("Return-Path",'<no-reply@bezdodavatele.cz>');     # HTML
421         $whitelist||=headeris("Return-Path",'<info@akce-cashback.cz>'); # unaware why
422         $whitelist||=headeris("From",'<@toptal.com>');  # unaware why
423         $whitelist||=headeris("Return-Path",'<@sendgrid.net>'); # unaware why, From: @toptal.com
424         $whitelist||=headeris("Return-Path",'<@ikea.com>');     # unaware why
425         $whitelist||=headeris("Return-Path",'<support@ecosupplements.eu>');     # HTML
426         $whitelist||=headeris("Return-Path",'<noreply@valid02.cloud.huawei.eu>');       # HTML
427         $whitelist||=headeris("From",'<info@nabytek-bydleni.cz>');      # HTML
428         $whitelist||=headeris("Return-Path",'<AMD@csobleasing.cz>');    # HTML
429         $whitelist||=headeris("Return-Path",'<screening@hireright.com>');       # HTML
430         $whitelist||=headeris("From",'<noreply@agistix.com>');  # HTML
431         $whitelist||=headeris("From",'<ibmacct@iam.ibm.com>');  # HTML
432         $whitelist||=headeris("Return-Path",'<community@lenovo.com>');  # HTML
433         $whitelist||=headeris("Return-Path",'<info@eureko.cz>');        # HTML
434         $whitelist||=headeris("From",'<noreply.peopleport@deloittece.com>');    # HTML
435         $whitelist||=headeris("From",'<info@osobniskore.cz>');  # HTML
436         $whitelist||=headeris("Return-Path",'<mluvii@o2.cz>');  # HTML
437         $whitelist||=headeris("Return-Path",'<info@jscomputers.cz>');   # HTML
438         $whitelist||=headeris("Return-Path",'<pujcky@hellobank.cz>');   # HTML
439         $whitelist||=headeris("From",'<noreply-edenredweb@cz.edenred.info>');   # HTML
440         $whitelist||=headeris("Return-Path",'<noreply@edenred.cz.prepaysolutions.com>');        # HTML
441         $whitelist||=headeris("Return-Path",'<no_reply@lidl-shop.cz>'); # HTML
442         $whitelist||=headeris("Return-Path",'<notifikace@identitaobcana.cz>');  # HTML
443         $whitelist||=headeris("Return-Path",'<obchod@thebodyshop.cz>'); # HTML
444         $whitelist||=headeris("Return-Path",'<thomas.jacobjacob@web.de>');      # HTML
445         $whitelist||=headeris("Return-Path",'<login@euc.cz>');  # HTML
446         $whitelist||=headeris("From",'<no-reply@ionity.eu>');   # HTML
447         $whitelist||=headeris("Return-Path",'<noreply@reservatic.com>');        # HTML
448         $whitelist||=headeris("Return-Path",'<info@kb.cz>');    # HTML
449         $whitelist||=headeris("Return-Path",'<info@allianz.cz>');       # HTML
450         $whitelist||=headeris("Return-Path",'<obchod@eo.cz>');  # HTML
451         $whitelist||=headeris("From",'<@linaro.org>');  # safety
452         $whitelist||=headeris("From",'<@embecosm.com>');        # safety
453         $whitelist||=headeris("From",'<futurego@cez.cz>');      # HTML
454         $whitelist||=headeris("From",'<no-reply@polyfazer.cz>');        # HTML
455         $whitelist||=headeris("Return-Path",'<info@innogy.cz>');        # HTML
456         $whitelist||=headeris("From",'<neodpovidat-prihlaseni@innogy.cz>');     # HTML
457         $whitelist||=headeris("From",'<info@molplugee.eu>');    # HTML
458         $whitelist||=headeris("Return-Path",'<noreply@plus4u.net>');    # HTML
459         $whitelist||=headeris("Return-Path",'<info@cdsw.cz>');  # HTML
460         $whitelist||=headeris("Return-Path",'<comic@eon.cz>');  # HTML
461         $whitelist||=headeris("Return-Path",'<oracle-acct_ww@oracle.com>');     # HTML
462         $whitelist||=headeris("From",'<noreply@vzp.cz>');       # HTML
463         $whitelist||=headeris("Return-Path",'<noreply.enelx@enel.com>');        # HTML
464         $whitelist||=headeris("From",'<account-update@amazon.com>');    # HTML
465         $whitelist||=headeris("Return-Path",'<info@dojezdove.cz>');     # HTML
466         $whitelist||=headeris("Return-Path",'<security@mail.instagram.com>');   # HTML
467         $whitelist||=headeris("Return-Path",'<lgproradost@airbuzz.cz>');        # HTML
468         $whitelist||=headeris("From",'<bok@greenwaypolska.pl>');        # HTML
469         $whitelist||=headeris("From",'<noreply@wise.com>');     # HTML
470         $whitelist||=headeris("Return-Path",'<info@charge.orlen.pl>');  # HTML
471         $whitelist||=headeris("Return-Path",'<noreply@revnet.pl>');     # HTML
472
473         # spam honeypots
474         return if did sub {
475                 local $_;
476                 return if $whitelist;
477                 # Do not local $store_file as it is our-imported
478                 $store_profile="silent";
479                 store "=spam"         if grep /^\Qshort\@k332.feld.cvut.cz\E/i,Received_for();
480                 # TODO: foreign violation of RFC 822 section 4.4.4, Subject:.*Automatick.+odpov.+v.+nep.+tomnosti
481                 store "=spam"         if headeris "From",'<ghandchi@hotmail.com>';
482                 store "=spam"         if headeris "From",'<newsletter@levnapc.cz>';
483                 store "=spam"         if headeris "From",'<Tomas@dtpstudio.cz>';
484                 store "=spam"         if headeris "From",'<obchod@dtpstudio.cz>';
485                 store "=spam"         if headeris "From",'<BNcom@email.bn.com>';
486                 store "=spam"         if headeris "From",'<e4luck@lists.opt4email.com>';
487                 store "=spam"         if headeris "From",'<mailcontests@lists.servitall.com>';
488                 store "=spam"         if headeris "From",'<canda@lica.cz>';
489                 store "=spam"         if headeris "From",'<newsletter@thecareernews.com>';
490                 store "=spam"         if headeris "From",'<newsletter@jobseekerweekly.com>';
491                 store "=spam"         if headeris "From",'<newsletter@jobmarketweekly.com>';
492                 store "=spam"         if headeris "From",'<newsletter@career-digest.com>';
493                 store "=spam"         if $Audit->subject() eq "Virus intercepted"
494                                       && body_simple()=~/^A message sent from\s.*\sto\s.*\scontained .* and has not been delivered[.]$/;
495                 store "=spam"         if headeris "From",'<supportmrswing@mrswing.com>';
496                 store "=spam"         if headeris "From",'<mrswing@mrswing.com>';
497                 store "=spam"         if headeris "From",'<root@filmcity.cz>';
498                 store "=spam"         if headeris "To"  ,'<web-www.filmcity.cz@jankratochvil.net>';
499                 store "=spam"         if headeris "From",'<ceniky@oxyshop.czechcomputer.cz>';
500                 store "=spam"         if headeris "From",'<news@linkedin.com>';
501                 store "=spam"         if headeris "To"  ,'<web-www.siemens-wm.cz@jankratochvil.net>';
502                 store "=spam"         if headeris "Return-Path",'<libucw-cz-bounces@ucw.cz>';
503                 store "=spam"         if headeris "Return-Path",'<libucw-devel-bounces@ucw.cz>';
504                 store "=spam"         if headeris("From",'<info@mmreality.cz>')
505                                       && headeris("Return-Path",'<postmaster@seznam.cz>');
506                 store "=spam"         if headeris "From",'<obchod@krasa.cz>';
507                 store "=spam"         if headeris "From",'<info@naradi-vitek.cz>';
508                 store "=spam"         if headeris "From",'<zpravodaj@naradi-vitek.cz>';
509                 store "=spam"         if headeris "Return-Path",'<letenky@pelikancz.emv5.com>';
510                 store "=spam"         if headeris "From",'<vase-parfumerie@elnino.cz>';
511                 store "=spam"         if headeris "From",qr/@(?:)zvraceny\.cz/;
512                 store "=spam"         if headeris("To"  ,'<4c-admin@jankratochvil.net>')
513                                       && body_simple()=~/workeuropenet\.com/;
514                 store "=spam"         if headeris("From",'<mailer-daemon@googlemail.com>')
515                                       && (body_simple()=~/\bgamma-burst\.com\b/ || body_simple()=~/\bopenwebtech\.ru\b/);
516                 store "=spam"         if headeris "Return-Path",'<anonymous@bender.tvujhosting.cz>'; # From: mkubinova@mmreality.cz
517                 store "=spam"         if headeris "Return-Path",'<noreply@e-rotickykontakt2.cz>';
518                 store "=spam"         if headeris "Return-Path",'<noreply@er0tickykontakt3.cz>';
519                 store "=spam"         if headeris "Return-Path",'<noreply@er0tickykontakt1.cz>';
520                 store "=spam"         if headeris "From",'<newsletter@eod.cz>';
521                 store "=spam"         if headeris "From",'<akce@prodejparfemu.cz>';
522                 store "=spam"         if headeris "From",'<club@prodejparfemu.cz>';
523                 store "=spam"         if headeris "From",qr/@(?:)badoo\.com/;
524                 store "=spam"         if headeris "Return-Path",'<info@elephant-orchestra.com>';
525                 store "=spam"         if headeris "Return-Path",'<marketing@expansys.fn1.co.uk>';
526                 store "=spam"         if headeris "Return-Path",'<info@prodejparfemu-2.superhosting.cz>';
527                 store "=spam"         if headeris "Return-Path",qr/postmaster\.twitter\.com/;
528                 store "=spam"         if headeris "Return-Path",'<noreply@icnfull.com>';
529                 store "=spam"         if headeris "Return-Path",'<eshop@barvic-novotny.cz>';
530                 store "=spam"         if headeris "To",'<aptive-list@jankratochvil.net>';
531                 store "=spam"         if headeris "To",'<captive-announce-list@jankratochvil.net>';
532                 store "=spam"         if headeris "To",'<captive-devel-list@jankratochvil.net>';
533                 store "=spam"         if headeris "To",'<captive-list@jankratochvil.net>';
534                 store "=spam"         if headeris "From",'<digest-noreply@quora.com>';
535                 store "=spam"         if headeris "Return-Path",'<info@descartes-agency.cz>';
536                 store "=spam"         if headeris "Subject",qr/Are you a go getter[?]$/;
537                 store "=spam"         if headeris "Subject",qr/Daily Stocks Tips$/;
538                 store "=spam"         if headeris "Subject",qr/If you get in now you could triple fast$/;
539                 store "=spam"         if headeris "From",'<info@datebook.cz>';
540                 store "=spam"         if headeris "From",'<newsletter@levneelektro.cz>';
541                 store "=spam"         if headeris "Return-Path",'<bounce-jan-jankratochvil.net@smartu5s6.cz>'; # From: info@levneelektro.cz
542                 store "=spam"         if headeris "X-Mailer",'WhatCounts';
543                 store "=spam"         if headeris("Subject",qr/New report this evening!$/)
544                                        &&headeris("From",qr/YahooFinance Canada/);
545                 store "=spam"         if headeris "Return-Path",'<obchod@ezoocentrum.cz>';
546                 store "=spam"         if headeris "Subject",qr/\bIt is time to buy COLV$/;
547                 store "=spam"         if headeris("Subject",qr/Shipping Information - Your Order #\d{3}-\d{4}$/)
548                                       && body_simple()=~/\QYour order will be shipped shortly, we apologize for the troubles. Please, review the invoice in the attached file.\E/;
549                 store "=spam"         if headeris("Subject",qr/Unpaid Invoice #\d{6}$/)
550                                       && body_simple()=~/\QPlease make sure you send payment for your parcel to avoid any inconvenience. Open the attached file to review the confirmation listing.\E/;
551                 store "=spam"         if headeris("Subject",qr/Compensation - Reference Number #\d{6}$/)
552                                       && body_simple()=~/\QThe mistake made will be compensated promptly, please do not worry.\E/;
553                 store "=spam"         if headeris("Subject",qr/FW: Refund RF-\d{6}$/)
554                                       && body_simple()=~/\QThe refund will go to your bank account. It may take a few moments for this transaction to appear in your account.\E/;
555                 store "=spam"         if headeris("Subject",qr/FW: Payment #\d{6}$/)
556                                       && body_simple()=~/\QPlease find attached an invoice that is now due for payment.\E/;
557                 store "=spam"         if headeris("Subject",qr/FW: Confirmation #\d{6}$/)
558                                       && body_simple()=~/\QPlease see attached the confirmation of transaction conducted from your account.\E/;
559                 store "=spam"         if headeris("Subject",qr/FW: Order Status #\d{6}$/)
560                                       && body_simple()=~/\QWe would like to thank you for your recent order.\E/;
561                 store "=spam"         if headeris("Subject",qr/FW: Statement S?#\d{6}$/)
562                                       && body_simple()=~/\QCan you please sign and return.\E/;
563                 store "=spam"         if headeris("Subject",qr/FW: Payment Details - \Q[\E\d{6}\Q]\E$/)
564                                       && body_simple()=~/\QFull details are attached to this email.\E/;
565                 store "=spam"         if headeris("Subject",qr/FW: Payment Receipt$/)
566                                       && body_simple()=~/\QThank you for your payment. It is important that you print this receipt and record the receipt number as proof of your payment.\E/;
567                 store "=spam"         if headeris("Subject",qr/FW: Overdue Incoices$/)
568                                       && body_simple()=~/\QPlease find attached copy updated statement as your account has 3 overdue incoices.\E/;
569                 store "=spam"         if headeris("Subject",qr/Bill N-[\dA-F]{6}$/)
570                                       && body_simple()=~/\QIn order to avoid fine you have to pay in 48 hours.\E/;
571                 store "=spam"         if headeris("Subject",qr/recent bill$/)
572                                       && body_simple()=~/\QPlease see attached file regarding clients recent bill. Should you need further assistances lease feel free to email me.\E/;
573                 store "=spam"         if headeris("Subject",qr/Additional Information Needed #\d{6}$/)
574                                       && body_simple()=~/\QWe kindly ask you to provide us additional information regarding your case.Please find the form attached down below.\E/;
575                 store "=spam"         if headeris("Subject",qr/\bEmailing: /)
576                                       && body_simple()=~/\QYour message is ready to be sent with the following file or link attachments:\E/;
577                 store "=spam"         if headeris("Subject",qr/\bDocuments$/)
578                                       && body_simple()=~/\QWe obtained such documents from your bank, please view the attached documents.\E/;
579                 store "=spam"         if MIME::Words::decode_mimewords($Audit->subject())=~/\bYour Latest Documents from Angel Springs Ltd \[[0-9A-F]{8}\]$/
580                                       && body_simple()=~/\QYour new documents are now attached to your email. You don't have to follow a link now to get to your documents.\E/;
581                 store "=spam"         if headeris("Subject",qr/\bRe:$/)
582                                       && body_simple()=~/\QPlease find the document file attached to this mail. The attached filecontains transfers and invoices history of your bank account.\E/;
583                 store "=spamre"       if headeris("Subject",qr/^\Q[SPAM] Re:\E$/);
584                 store "=spam"         if headeris("Subject",qr/\bCorresponding Invoice$/)
585                                       && body_simple()=~/\QThank you for your email regarding your order of 21 June, and sorry for the delay in replying. I am\E/;
586                 store "=spam"         if headeris("Subject",qr/\bPayment$/)
587                                       && body_simple()=~/\QOur records show that we have not yet received payment for the previous order\E/;
588                 store "=spam"         if headeris("Subject",qr/\bFinal version of the report$/)
589                                       && body_simple()=~/\Qasked me to send you the attached Word document, which contains the final version of the report.\E/;
590                 store "=spam"         if headeris("Subject",qr/\bUpdated document$/)
591                                       && body_simple()=~/\QThe reference you requested is attached.\E/;
592                 store "=spam"         if headeris("Subject",qr/\bRequested document$/)
593                                       && body_simple()=~/\QThe document you requested is attached.\E/;
594                 store "=spam"         if headeris("Subject",qr/\bUpdated$/)
595                                       && body_simple()=~/\QAttached please find the documents you requested.\E/;
596                 store "=spam"         if headeris("Subject",qr/\breport$/)
597                                       && body_simple()=~/\QI've attached the report you asked me to send.\E/;
598                 store "=spam"         if headeris("Subject",qr/\bnew invoice$/)
599                                       && body_simple()=~/\QI am sending you the invoice you requested.\E/;
600                 store "=spam"         if headeris("Subject",qr/\bDocuments copies$/)
601                                       && body_simple()=~/\QI am sending copies of the documents as attachments.\E/;
602                 store "=spam"         if headeris("Subject",qr/\bFw:\s*$/)
603                                       && body_simple()=~/\QHere's that excel file (latest invoices) that you wanted.\E/;
604                 store "=spam"         if headeris("Subject",qr/\bProfile$/)
605                                       && body_simple()=~/\QPlease find attached the profile of Mr.\E.*\Q for a suitable role in your Organisation\E/;
606                 store "=spam"         if headeris("Subject",qr/\b(?:Scan|Attahed|Letter)$/)
607                                       && body_simple()=~/\QPlease find the reference letter I attached.\E/;
608                 store "=spam"         if headeris("Subject",qr/\b(?:Scan|Attahed|Letter)$/)
609                                       && body_simple()=~/\QPlease find attached the reference letter.\E/;
610                 store "=spam"         if headeris("Subject",qr/\b(?:Scan|Attahed|Letter)$/)
611                                       && body_simple()=~/\QThe reference letter you requested is attached.\E/;
612                 store "=spam"         if headeris("Subject",qr/\bbank account report$/)
613                                       && body_simple()=~/\QThank you very much for responding my email in a very short time. Attached is\E/;
614                 store "=spam"         if headeris("Subject",qr/\bcompany database$/)
615                                       && body_simple()=~/\QI am deeply gratified that you reacted to my email promptly.\E/;
616                 store "=spam"         if headeris("Subject",qr/\bBusiness Analysis$/)
617                                       && body_simple()=~/\QI attached the detailed business analysis (updated}\E/;
618                 store "=spam"         if headeris("Subject",qr/\bfixed invoice$/)
619                                       && body_simple()=~/\QI am very sorry for the wrong data file you received from me yesterday.\E/;
620                 store "=spam"         if headeris("Subject",qr/\bFinancial statement$/)
621                                       && body_simple()=~/\QPardon me for the delay in responding to your last email.\E/;
622                 store "=spam"         if headeris("Subject",qr/\bsales report$/)
623                                       && body_simple()=~/\QI am truly sorry that I was not available at the time you called me yesterday.\E/;
624                 store "=spam"         if headeris("Subject",qr/\blist of activities$/)
625                                       && body_simple()=~/\QAttached is the list of activities to help you arrange for the coming presentation. Please read it carefully and write to me if you have any concern.\E/;
626                 store "=spam"         if headeris("Subject",qr/\bBusiness card$/)
627                                       && body_simple()=~/\QI have attached the new business card design.\E/;
628                 store "=spam"         if headeris("Subject",qr/\bplease sign$/)
629                                       && body_simple()=~/\QPlease sign the receipt attached for the arrival of new office facilities.\E/;
630                 store "=spam"         if headeris("Subject",qr/\bBudget Reports$/)
631                                       && body_simple()=~/\QI attached the annual budget reports that you asked me to send to you.\E/;
632                 store "=spam"         if headeris("Subject",qr/\bDocuments Requested$/)
633                                       && body_simple()=~/\QPlease find attached documents as requested.\E/;
634                 store "=spam"         if headeris("Subject",qr/\bNew Doc \d+-\d+$/)
635                                       && body_simple()=~/\QScanned by CamScanner\E/;
636                 store "=spam"         if headeris("Subject",qr/\bOrder Confirmation-[-\d]+$/)
637                                       && body_simple()=~/\QThis communication and any files transmitted with it contain information which is confidential and which may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please note that any disclosure, copying, printing or use whatsoever of this communication or the information contained in it is strictly prohibited. If you have received this communication in error, please notify us by e-mail or by telephone as above and then delete the e-mail together with any copies of it.\E/;
638                 store "=spam"         if headeris("Subject",qr/\bContract$/)
639                                       && body_simple()=~/\QPlease sign the attached contract with our technical service company for\E/;
640                 store "=spam"         if headeris("Subject",qr/\boffice equipment$/)
641                                       && body_simple()=~/\QPlease sign the attached purchase of the office equipment. We will send you back the receipt afterward.\E/;
642                 store "=spam"         if headeris("Subject",qr/\bCommission$/)
643                                       && body_simple()=~/\QHere is the excel file of the commission you earned last month. Please analyze\E/;
644                 store "=spam"         if headeris("Subject",qr/\bmortgage documents$/)
645                                       && body_simple()=~/\Q, I am attaching the mortgage documents relating to your department.\E/;
646                 store "=spam"         if headeris("Subject",qr/\bTransaction details$/)
647                                       && body_simple()=~/\Q, The transaction you requested was not able to proceed. Please see the attachment to recheck the account number.\E/;
648                 store "=spam"         if headeris("Subject",qr/\bpaycheck$/)
649                                       && body_simple()=~/\Q, as you requested, attached is the paycheck for your next month\E/;
650                 store "=spam"         if headeris("Subject",qr/\bbank transactions$/)
651                                       && body_simple()=~/\QAttached is the bank transactions made from the company during last month.\E/;
652                 store "=spam"         if headeris("Subject",qr/\bflight tickets$/)
653                                       && body_simple()=~/\QI am sending you the flight tickets for your business conference abroad next month.\E/;
654                 store "=spam"         if headeris("Subject",qr/\bShipping information$/)
655                                       && body_simple()=~/\QOur shipping service is sending the order form due to the request from your company.\E/;
656                 store "=spam"         if headeris("Subject",qr/\bCredit card receipt$/)
657                                       && body_simple()=~/\QWe are sending you the credit card receipt from yesterday. Please match the card number and amount.\E/;
658                 store "=spam"         if headeris("Subject",qr/\bAugust invoice$/)
659                                       && body_simple()=~/\Qasked me to send you invoice for August. Please look over the attachment and make a payment ASAP.\E/;
660                 store "=spam"         if headeris("Subject",qr/\bSuspected Purchases$/)
661                                       && body_simple()=~/\QPlease take a look at the attached account balance to see the purchase history.\E/;
662                 store "=spam"         if headeris("Subject",qr/\bAgreement form$/)
663                                       && body_simple()=~/\Qassigned you to make the payment agreement for the new coming employees.\E/;
664                 store "=spam"         if headeris("Subject",qr/\bInvoice #[0-9a-f]{5}-2016$/)
665                                       && body_simple()=~/\Qwe have attached the debt payment invoice. Please view the due amount.\E/;
666                 store "=spam"         if headeris("Subject",qr/\bOrder Confirmation \d+$/)
667                                       && body_simple()=~/\QThis message is intended only for the individual or entity to which it is\E/;
668                 store "=spam"         if headeris("Subject",qr/\bBudget report$/)
669                                       && body_simple()=~/\QI have partially finished the last month's budget report you asked me to do. Please add miscellaneous expenses in the budget.\E/;
670                 store "=spam"         if headeris("Subject",qr/\bConfirmation letter$/)
671                                       && body_simple()=~/\QThe bank has sent loan confirmation letter. Please review the amount of funds.\E/;
672                 store "=spam"         if headeris("Subject",qr/\bTax invoice$/)
673                                       && body_simple()=~/\QAttached is the tax invoice of your company. Please do the payment in an urgent manner.\E/;
674                 store "=spam"         if headeris("Subject",qr/\bEquipment receipts$/)
675                                       && body_simple()=~/\QHere is the photocopying equipment receipts purchased last week.\E/;
676                 store "=spam"         if headeris("Subject",qr/\bAccount report$/)
677                                       && body_simple()=~/\Qwe have detected the cash over and short in your account.\E/;
678                 store "=spam"         if headeris("Subject",qr/\bDelivery Confirmation: \d+$/)
679                                       && body_simple()=~/\QPlease contact us if there are any questions or further assistance we can provide\E/;
680                 store "=spam"         if headeris("Subject",qr/\bRenewed License$/)
681                                       && body_simple()=~/\QPlease see the attached license and send it to the head office.\E/;
682                 store "=spam"         if headeris("Subject",qr/\bfinancial report$/)
683                                       && body_simple()=~/\QHere are some accounting data I have collected. Please merge it into your report.\E/;
684                 store "=spam"         if headeris("Subject",qr/\bBooking confirmation$/)
685                                       && body_simple()=~/\QSee the attachment to confirm the booking.\E/;
686                 store "=spam"         if headeris("Subject",qr/\brequest$/)
687                                       && body_simple()=~/\QLet me know whether it is the correct invoice number you needed or not.\E/;
688                 store "=spam"         if headeris("Subject",qr/\bOut of stock$/)
689                                       && body_simple()=~/\QPlease take a look and let us know if you would like to substitute with any of them.\E/;
690                 store "=spam"         if headeris("Subject",qr/\bPackage$/)
691                                       && body_simple()=~/\QDear customer, we have sent your package today. Please have a look at the receipt attached.\E/;
692                 store "=spam"         if headeris("Subject",qr/\bPayment approved$/)
693                                       && body_simple()=~/\QYour payment has been approved. Your account will be debited within two days.\E/;
694                 store "=spam"         if headeris("Subject",qr/\bDelivery #D-\d{7}$/)
695                                       && body_simple()=~/\QAll the details are in the attachment. Delivery will arrive at 15:00 coming Monday.\E/;
696                 store "=spam"         if headeris("Subject",qr/\bTransactions details$/)
697                                       && body_simple()=~/\QAs you requested, attached is the scan of all the transactions your account made in September 2016.\E/;
698                 store "=spam"         if headeris("Subject",qr/\bUpdated invoice #\d{7}$/)
699                                       && body_simple()=~/\QOur sincere apology for the incorrect invoice we sent to you yesterday.\E/;
700                 store "=spam"         if headeris("Subject",qr/\bPayment$/)
701                                       && body_simple()=~/\QYou are receiving this email because the company has assigned you as part of the approval team.\E/;
702                 store "=spam"         if headeris("Subject",qr/\bPayment$/)
703                                       && body_simple()=~/\QPlease read through the attachment and return us the scan of the signed contract.\E/;
704                 store "=spam"         if headeris("Subject",qr/\bTemporarily blocked$/)
705                                       && body_simple()=~/\Qthis is to inform you that your Debit Card is temporarily blocked as there were unknown transactions made today.\E/;
706                 store "=spam"         if headeris("Subject",qr/\bParcel details$/)
707                                       && body_simple()=~/\QAttached is the shipment label. Please print it out to take the parcel from our office.\E/;
708                 store "=spam"         if headeris("Subject",qr/\bReceipt \d+-\d+$/)
709                                       && body_simple()=~/^\s*$/s;
710                 store "=spam"         if headeris("Subject",qr/\bplease sign$/)
711                                       && body_simple()=~/\QI have made the paperwork you asked me to prepare two days ago.\E/;
712                 store "=spam"         if headeris("Subject",qr/\Q[Scan]\E 2016-\d{4} \d{2}:\d{2}:\d{2}$/)
713                                       && body_simple()=~/\QSent with Genius Scan for iOS.\E/;
714                 store "=spam"         if headeris("Subject",qr/\bInvoice-\d+-\d+-\d+-[0-9A-F]+$/)
715                                       && body_simple()=~/\QShould you have any Invoice related queries please do not hesitate to contact either your designated Credit Controller or the Main Credit\E/;
716                 store "=spam"         if headeris("Subject",qr/\bTravel Itinerary$/)
717                                       && body_simple()=~/\QThank you for flying with us! We attached the Travel Itinerary for Your booking number\E/;
718                 store "=spam"         if headeris("Subject",qr/\bCancellation request$/)
719                                       && body_simple()=~/\Q, you need to fill out the cancellation form attached in this email.\E/;
720                 store "=spam"         if headeris("Subject",qr/\bYour Order$/)
721                                       && body_simple()=~/\QKindly keep the slip in case you would like to return or state your product's warranty.\E/;
722                 store "=spam"         if headeris("Subject",qr/\bwrong paychecks$/)
723                                       && body_simple()=~/\QThey send us the wrong paychecks. Attached is your paycheck arrived to my email by mistake.\E/;
724                 store "=spam"         if headeris("Subject",qr/\bComplaint letter$/)
725                                       && body_simple()=~/\QClient sent a complaint letter regarding the data file you provided.\E/;
726                 store "=spam"         if headeris("Subject",qr/\bBill overdue$/)
727                                       && body_simple()=~/\QThis is fromthe Telephone Company to remind you that your bill is overdue.\E/;
728                 store "=spam"         if headeris("Subject",qr/\bPayment history$/)
729                                       && body_simple()=~/\QThe payment history for the firstweek of October 2016 is attached as you requested.\E/;
730                 store "=spam"         if headeris("Subject",qr/\bWrong tracking number$/)
731                                       && body_simple()=~/\QIt looks like the deliverycompany gave us the wrong tracking number.\E/;
732                 store "=spam"         if headeris("Subject",qr/\bTransactions$/)
733                                       && body_simple()=~/\Qcalled me yesterday updating about the transactions on company's account from last month.\E/;
734                 store "=spam"         if headeris("Subject",qr/\bBill$/)
735                                       && body_simple()=~/\QTo continue using our maintenance service, please pay for last month's fee by 4th of November.\E/;
736                 store "=spam"         if headeris("Subject",qr/\bPlease verify$/)
737                                       && body_simple()=~/\Qas you requested, I have proofread the technical document you sent.\E/;
738                 store "=spam"         if headeris("Subject",qr/\bHealth Insurance$/)
739                                       && body_simple()=~/\Qthis is from the insurance company concerning with your health insurance.\E/;
740                 store "=spam"         if headeris("Subject",qr/\bOrder$/)
741                                       && body_simple()=~/\QThe item you've ordered is on delay due to the unknown problem regarding your bank account you paid from.\E/;
742                 store "=spam"         if headeris("Subject",qr/\bVirtual card$/)
743                                       && body_simple()=~/\QDear Client! A virtual card you have ordered is now ready but not active.\E/;
744                 store "=spam"         if headeris("Subject",qr{\bInvoice for \d+ \d+/\d+/\d{4}$})
745                                       && body_simple()=~/\QThis email confirms that your goods have been dispatched. Please find attached your Invoice in PDF format.\E/;
746                 store "=spam"         if headeris("Subject",qr{\bPlease Pay Attention$})
747                                       && body_simple()=~/\Qwe have received your payment but the amount was not full.\E/;
748                 store "=spam"         if headeris("Subject",qr{\bAttention Required$})
749                                       && body_simple()=~/\QFines may apply from the third party. We are sending you the details in the attachment.\E/;
750                 store "=spam"         if headeris("Subject",qr{\bIt Is Important$})
751                                       && body_simple()=~/\QSending you the report of the problem - please open the attachment and check the data.\E/;
752                 store "=spam"         if headeris("Subject",qr{\bNew voice mail message from \d+ on })
753                                       && body_simple()=~/\QYou might want to check it when you get a chance.Thanks!\E/;
754                 store "=spam"         if headeris("Subject",qr{\bUrgent Alert$})
755                                       && body_simple()=~/\QAll the details are in the attachment. Please open it when possible.\E/;
756                 store "=spam"         if headeris("Subject",qr{\bFor Your Consideration$})
757                                       && body_simple()=~/\QAll details are in the attachment. Please check it out to see whether we are right.\E/;
758                 store "=spam"         if headeris("Subject",qr{\bFile COPY.29112016.944358.XLS Sent 29/11/2016$})
759                                       && body_simple()=~/\Qcan you please pass this invoice for payment  thank you\E/;
760                 store "=spam"         if headeris("Subject",qr{\bUrgent$})
761                                       && body_simple()=~/\Qour accountant informed me that in the bill you processed, the invalid account number had been specified.\E/;
762                 store "=spam"         if headeris("Subject",qr{\bPlease Consider This$})
763                                       && body_simple()=~/\QPlease confirm the amount and let us know if you have any questions.\E/;
764                 store "=spam"         if headeris("Subject",qr{\b\QThis stock is about to receive a buy out at 10 times its current market price...\E$})
765                                       && body_simple()=~/\QIt's been a long time since I sent you my special newsletter containing a hot stock tip.\E/;
766                 store "=spam"         if headeris("Subject",qr{\b\QYou can make 10x on your money by next week if you buy this stock now.\E$})
767                                       && body_simple()=~/\QDo you remember the last time I sent you a tip about a company worth buying in the market?\E/;
768                 store "=spam"         if headeris("Subject",qr{\b\QHere is your chance to buy shares that will go up 10x by next week.\E$})
769                                       && body_simple()=~/\QAs you obviously know, I have been quiet these last couple of months because I really have not had a stock worth recommending for\E/;
770                 store "=spam"         if headeris("Subject",qr{\b\QThis public company is being bought out. Read now to profit from it.\E$})
771                                       && body_simple()=~/\QIt has been a very long time since I emailed you about a rare investment opportunity.\E/;
772                 store "=spam"         if headeris("Subject",qr{\b\QRead Now: Why this company\E.*\Qs shares are guaranteed to soar next week.\E$})
773                                       && body_simple()=~/\QWe haven't communicated in a while and you might be wondering why I'm emailing you now out of the blue but it's because I have something\E/;
774                 store "=spam"         if headeris("Subject",qr{\b\QI've got strong reasons to believe that this stock is about to soar.\E$})
775                                       && body_simple()=~/\QWe've been out of touch for a while. I've been very busy looking for the next big stock that has the potential to explode and it took me\E/;
776                 store "=spam"         if headeris("Subject",qr{\b\QAllow me to share something profitable with you today.\E$})
777                                       && body_simple()=~/\QIf you're wondering why I'm emailing you now, out of the blue, after months of radio silence let me tell you that I have a good reason\E/;
778                 store "=spam"         if headeris("Subject",qr{\b\QBy tomorrow evening this stock will be twenty times higher\E$})
779                                       && body_simple()=~/\QI outlined very specifically a game plan for you to make more than 20 times on your principle within the next 48 hours.\E/;
780                 store "=spam"         if headeris("Subject",qr{\b\QThis company's being acquired tomorrow\E$})
781                                       && body_simple()=~/\QThe cat might be out of the bag now but there is still a massive opportunity to benefit.\E/;
782                 store "=spam"         if headeris("Subject",qr{\b\QYour chance to make an amazing move is quickly slipping away\E$})
783                                       && body_simple()=~/\QThere is reason for excitement. A good friend of mine who works at a high place which I will not name told me about a crazy\E/;
784                 store "=spam"         if headeris("Subject",qr{\b\QThis is your opportunity to get a 20 bagger in the market very fast\E$})
785                                       && body_simple()=~/\QOne of my closest buddies, who happens to be a banker, let me in on a little tip earlier on.\E/;
786                 store "=spam"         if headeris("Subject",qr{\b\QHere's a life changing tip that will guide you through trump's America\E$})
787                                       && body_simple()=~/\QGiven the current political climate, there are very few certain things in this world.\E/;
788                 store "=spam"         if headeris("Subject",qr{\b\QHere's why this company's shares are about to go up tenfold next week.\E$})
789                                       && body_simple()=~/\QYes, it's been some time since I reached out to you with something good but trust me? the wait will have been worth it.\E/;
790                 store "=spam"         if headeris("Subject",qr{\b\QLet me tell you why this stock will go up 10x by next week.\E$})
791                                       && body_simple()=~/\QHaven't heard from me in a while right? That's because I'm not one to waste your time.\E/;
792                 store "=spam"         if headeris("Subject",qr{\b\QYou can make more than ten times your principle with just this 1 stock\E$})
793                                       && body_simple()=~/\QIt's been at least a few monthssince the last time I had the chance to share something amazing withyou\E/;
794                 store "=spam"         if headeris("Subject",qr{\b\QThis biotech stock is guaranteed to jump 10x next week\E$})
795                                       && body_simple()=~/\QThis is going to sound crazy, but you remember last year when I told you tobuy the mobile apps company before Sony\E/;
796                 store "=spam"         if headeris("Subject",qr{\b\QIn less than 5 days this company could yield you a ten bagger\E$})
797                                       && body_simple()=~/\QI've beeninvolved in the markets for a few decades now and I'll be the first totell you that things have never been as uncertain\E/;
798                 store "=spam"         if headeris("Subject",qr{\b\QCan you really make ten fold on your principal in just a few days?\E$})
799                                       && body_simple()=~/\QWith today's political climate, it is becoming increasing difficult tofind winning stocks.\E/;
800                 store "=spam"         if headeris("Subject",qr{\b\QNot sure where to invest? Here's a sure bet.\E$})
801                                       && body_simple()=~/\QOur country is going through astrange era. Recent political changes have oddly affected the marketsand pretty much most stocks\E/;
802                 store "=spam"         if headeris("Subject",qr{\b\QThis company just found a huge cure and no one knows about it yet!\E$})
803                                       && body_simple()=~/\QDid you ever read an articleonline, or in a magazine praising some so called guru for making a fewhundred grand out of just a few\E/;
804                 store "=spam"         if headeris("Subject",qr{\b\QHere's an idea that could make you a small fortune...\E$})
805                                       && body_simple()=~/\QI'm not one to just goaround and tell my friends random things\E/;
806                 store "=spam"         if headeris("Subject",qr{\b\QLet me share with you something that could make you big bucks\E$})
807                                       && body_simple()=~/\QI have been around theblock. I'm a veteran in this market. I was making my subscribersprofits through both Bush, Obama and now Trump.\E/;
808                 store "=spam"         if headeris("Subject",qr{\bCopy of Invoice \d+$})
809                                       && body_simple()=~/\QIf you have any further questions regarding your invoice, please call Customer Service.\E/;
810                 store "=spam"         if headeris("Subject",qr{\bHello$})
811                                       && body_simple()=~/\QI see you frequently visit this site, so I wanted to talk to you today but you had already left the chat.\E/;
812                 store "=spam"         if headeris("Subject",qr{\bHi$})
813                                       && body_simple()=~/\QAre you often visit this site if not, we can talk in other social networks.\E/;
814                 store "=spam"         if headeris("Subject",qr{\bI guarantee that this company will quadruple before Friday. Check it out$})
815                                       && body_simple()=~/\QEven non traditional places to stash some savings like bitcoin are out of control at an all time high.\E/;
816                 store "=spam"         if headeris("Subject",qr{\bThis stock is gonna go up 4 fold before the end of the week.$})
817                                       && body_simple()=~/\QOne of my best friends who happens to be employed at the largest firm in new york told me that I should really consider buying a specific\E/;
818                 store "=spam"         if headeris("Subject",qr{\bHow are you[?]$})
819                                       && body_simple()=~/\QDo you visit this site oftentimes? I was hoping to talk to you in chat once but you left all of a sudden. Could you write me your address\E/;
820
821                 # Whitelist - HTML.
822                 return if headeris("From",'<oznameni@aukro.cz>');
823                 return if headeris("Return-Path",'<noreply@checkmytrip.com>');
824                 for my $header (qw(To Cc)) {
825                         store "=spam" if headerhas $header,'<st@jankratochvil.net>';
826                         store "=spam" if headerhas $header,'<est@jankratochvil.net>';
827                         store "=spam" if headerhas $header,'<uest@jankratochvil.net>';
828                         store "=spam" if headerhas $header,'<kratochvil.net@jankratochvil.net>';
829                         }
830                 {
831                         # weak detection: files with text/html w/o text/plain are usually a spam
832                         my @types_linear=map({ mime_type($_); } parts_linear());
833                         store "=spam"       if grep({ $_ eq "text/html"; } @types_linear) && !grep({ $_ eq "text/plain"; } @types_linear);
834                         }
835                 store "=spam"         if ($_=mimehead(body_first())->mime_attr("Content-Type.charset")) && /^big5/i;
836                 };
837         $store_profile=undef();
838
839         my %mailman=(
840                         '<captive-admin@>'=>"=caperr",
841                         '<captive-devel-admin@>'=>"=caperr",
842                         '<captive-announce-admin@>'=>"=caperr",
843                         '<4c-admin@>'=>"=4cerr",
844                         );
845         return if did sub {
846                 if (!did sub {
847                                 while ((my($mailaddr,$folder)=each(%mailman))) {
848                                         (my $maillistaddr=$mailaddr)=~s/-admin/-list$&/;
849                                         store $folder,"log" if (headeris("From",'<mailman-owner@vellum.cz>')&&headeris("To",$mailaddr))
850                                                         || headeris("From",$maillistaddr)
851                                                         || headeris("To",$maillistaddr)
852                                                         || headeris("From",$mailaddr);
853                                         }
854                                 }) {
855                         store "=cap","bell"        if headeris "List-Id"  ,'<captive-list.jankratochvil.net>';
856                         store "=capd","bell"       if headeris "List-Id"  ,'<captive-devel-list.jankratochvil.net>';
857                         store "=capann","bell"     if headeris "List-Id"  ,'<captive-announce-list.jankratochvil.net>';
858                         store "=4c","bell"         if headeris "List-Id"  ,'<4c-list.vellum.cz>';
859                         }
860                 };
861
862 #       {
863 #               my $mailed=0;
864 #               if ($Audit->header()!~/for <(?:4c|vmezihori1XXX)-(?:admin|owner|bounces)@/) {
865 #                       for my $list qw(vmezihori1) {
866 #                               $mailed+=dolist $list;
867 #                       }
868 #               }
869 #               # return if $mailed;
870 #       }
871
872         # fast spam detection
873         return if did sub {
874                 $store_profile="log";
875                 store "=spammms2"                    if headeris "To",'<@mms2.cz>';
876         };
877         # spam detection
878         return if did sub {
879                 # It is too expensive to scan the huge =caperr announcements by spamassassin(1).
880                 return if $whitelist;
881 ###             return if headeris("From",qr/^captive-[a-z]*@/);
882                 return if headeris("From",'<logwatch@jankratochvil.net>');
883                 # Do not local $store_file as it is our-imported
884                 $store_profile="log";
885                 local $_;
886                 store "=spamclam".";virus=$_"        if $_=clamscan();
887                 store "=spam".";spamassassin".($_ eq 1 ? "" : "=$_") if $_=spamassassin();
888 # Down?
889 ###             store "=spam".";$_"                  if $_=dnsbl '.relays.ordb.org.' ,1;        # all hosts
890 if (0) {
891                 store "=spam".";$_"                  if $_=dnsbl '.blackholes.mail-abuse.org.' ,1;      # all hosts
892                 # we don't check all hosts as they can be "dialup" category, FIXME: check for it
893 #               store "=spam".";$_"                  if $_=dnsbl '.blackholes.five-ten-sg.com.',0; # just first
894 }
895                 # I don't send viruses but viruses propagate mails of mine
896                 store "=spam".";ravmd"               if headeris "X-Mailer",'ravmd/8.3.2';
897                 store "=spam".';short@ucw.cz+MAILER' if $isFROM_MAILER && headeris("To",'<short@ucw.cz>');
898                 if (!is_multipart()) {
899                         local $_=mimebody(body_first());
900                         my %sites=map(($_=>1),qw(
901                                         brandenburg.rz.fhtw-berlin.de
902                                         forum.gofeminin.de
903                                         service.spiegel.de
904                                         www.aufenthaltstitel.de
905                                         www.berlinonline.de
906                                         www.deutschlandchronik.de
907                                         www.heise.de
908                                         www.leverkusener-aufbruch.com
909                                         www.libasoli.de
910                                         www.mjoelnirsseite.de
911                                         www.npd-nrw.net
912                                         www.npd.de
913                                         www.rp-online.de
914                                         www.spiegel.de
915                                         www.taz.de
916                                         www.unserforum.com
917                                         www.zdf.de
918                                         ));
919                         my $found;
920                         while (m{http://([^/]+)/}g) {
921                                 do { $found=1; next; } if $sites{$1};
922                                 $found=0;
923                                 last;
924                                 }
925                         $found=1 if /^\s*Lese selbst:\n/s;
926                         store "=spam".';german-news' if $found;
927                         }
928                 };
929         $store_profile=undef();
930
931         # special delivery
932         store "=err","bell" and return if headerhas \&Received_for,'<short+err@>';
933
934         # ppl-wished foreign remapping, Reply-To is left untouched!
935         # FIXME: modifications are now being dropped by &write_message!
936         header_remap("From",{
937                         'kerere@post.cz'               =>'kamzik@k332.feld.cvut.cz',
938                         'profes@mbox.vol.cz'           =>'kratochvilova@egp.cz',
939                         'jkrouzek@mbox.vol.cz'         =>'krouzek@mbox.fsv.cuni.cz',
940                         'jakub.gorner@lidovky.cz'      =>'tonda@disnet.cz',
941                         'jan.kolar@videoprogress.cz'   =>'jenda.kolar@volny.cz',
942                         'daniel.rulicek@cponline.cz'   =>'daniel.rulicek@cpress.cz',
943                         'pavel@suse.cz'                =>'pavel@ucw.cz',
944                         });
945
946         # My obsolete e-mail addresses
947         store_muttrc_alternates "=redirect-","btw";
948
949         # nasty public lists with $store_ignore
950         {
951                 # Do not local $store_file as it is our-imported
952                 $store_profile="log";
953                 local $store_ignore;
954                 $store_ignore="smsmail"    if 1==$Audit->body() && length(join "",$Audit->body())<180;  # SMS mail
955                 $store_ignore="sms OS"     if $Audit->subject()=~/^Email pro: /;        # "^Email pro: gsm@sh\.cvut\.cz$";
956                 $store_ignore="list-moron" if grep { headeris "From",$_; } qw(
957                                 <kempny@>
958                                 <help.me@wo.cz>
959                                 <mr.death@mail.cz>
960                                 <danx3@centrum.cz>
961                                 <@mujoskar.cz>
962                                 <satko@quanto.nr.sanet.sk>
963                                 <vithous@attorney.cz> <viroman@attorney.cz>
964                                 <konf@klain.cz>
965                                 <stein@tiscali.cz>
966                                 <barevnej@volny.cz>
967                                 );
968
969                 store "=gsm"               if headeris  "X-BeenThere",'<gsm@lists.sh.cvut.cz>';
970                 store "=gsmpand"           if headeris  "List-Post",'<gsm@pandora.cz>';
971                 store "=9kc","log"         if headeris  "List-Post",'<n9k@pandora.cz>';
972                 store "=9kcd","log"        if headeris  "List-Post",'<dev9k@pandora.cz>';
973                 }
974         $store_profile=undef();
975
976         return                       if headeris "From"     ,'<surprise-dev-bounces@lists.sourceforge.net>';
977
978         # lists
979         store "=mozillabug","log"    if headeris "From"     ,'<bugzilla-daemon@mozilla.org>';
980         store "=9ku","log"           if headeris "List-Id"  ,'<9000.listman.net>';
981         store "=9kd","log"           if headeris "Sender"   ,'<owner-9000-developers@geekstuff.co.uk>';
982         store "=spong","log"         if headeris "List-Id"  ,'<spong-users.lists.sourceforge.net>';
983         store "=gtkd","silent"       if headeris "List-Id"  ,'<gtk-devel-list.gnome.org>';
984         store "=gtkappd","silent"    if headeris "List-Id"  ,'<gtk-app-devel-list.gnome.org>';
985         store "=gnomevfs","log"      if headeris "List-Id"  ,'<gnome-vfs-list.gnome.org>';
986         store "=mffstatnice","bell"  if headeris "List-Post",'<statnice@atrey.karlin.mff.cuni.cz>';
987         store "=hw","log"            if headeris "List-Post",'<hw-news@list.gin.cz>';
988         store "=gnokii","log"        if headeris "List-Id"  ,'<gnokii-users.mail.freesoftware.fsf.org>';
989         store "=winelic","silent"    if headeris "List-Id"  ,'<wine-license.winehq.org>';
990         store "=wined","silent"      if headeris "List-Id"  ,'<wine-devel.winehq.org>';
991         store "=winepat","silent"    if headeris "List-Id"  ,'<wine-patches.winehq.org>';
992         store "=winecvs","silent"    if headeris "List-Id"  ,'<wine-cvs.winehq.org>';
993         store "=wineann","silent"    if headeris "List-Id"  ,'<wine-announce.winehq.org>';
994         store "=wineconf","silent"   if headeris "List-Id"  ,'<wineconf.winehq.org>';
995         store "=ros","silent"        if headeris "List-Id"  ,'<ros-general.reactos.com>';
996         store "=roskernel","silent"  if headeris "List-Id"  ,'<ros-kernel.reactos.com>';
997         store "=rosd","silent"       if headeris "List-Id"  ,'<ros-dev.reactos.com>';
998         store "=roscvs","silent"     if headeris "List-Id"  ,'<ros-cvs.reactos.com>';
999         store "=rossvn","silent"     if headeris "List-Id"  ,'<ros-svn.reactos.com>';
1000         store "=rosbug","silent"     if headeris "Reply-To" ,'<scarab@reactos.wox.org>';
1001         store "=fsd","silent"        if headeris "X-Mailing-List",'<linux-fsdevel@vger.kernel.org>';
1002         store "=kernel","silent"     if headeris "X-Mailing-List",'<linux-kernel@vger.kernel.org>';
1003         store "=kernelnet","silent"  if headeris "X-Mailing-List",'<linux-net@vger.kernel.org>';
1004         store "=ia64","silent"       if headeris "X-Mailing-List",'<linux-ia64@vger.kernel.org>';
1005         store "=linuxjap","silent"   if headeris "X-Mailing-List",'<linux-japanese@vger.kernel.org>';
1006         store "=kernelann","silent"  if headeris "X-Mailing-List",'<linux-kernel-announce@vger.kernel.org>';
1007         store "=sparse","silent"     if headeris "X-Mailing-List",'<linux-sparse@vger.kernel.org>';
1008         store "=smp","silent"        if headeris "X-Mailing-List",'<linux-smp@vger.kernel.org>';
1009         store "=surprise","sms"      if headeris "List-Post",'<surprise@atrey.karlin.mff.cuni.cz>';
1010         store "=surprisesuse","sms"  if headeris "Sender"   ,'<owner-surprise@suse.cz>';
1011         store "=tacacs","silent"     if headeris "Sender"   ,'<tacplus-l@disaster.com>';
1012         store "=tacacs","silent"     if headeris "Sender"   ,'<owner-tacplus-l@disaster.com>';
1013         store "=tacacs","silent"     if headeris "List-Id"  ,'<devel.lists.tacplus.org>';
1014         store "=pm","log"            if headeris "List-Id"  ,'<prague-pm.pm.org>';
1015         store "=radary","log"        if headeris "Reply-To" ,'<pha@radary.cz>';
1016         store "=dnet","log"          if headeris "Sender"   ,'<@lists.distributed.net>';
1017         store "=linux-input","log"   if headeris "List-Post",'<linux-input@atrey.karlin.mff.cuni.cz>';
1018         store "=strom","bell"        if headeris "List-Post",'<vodni-strom@atrey.karlin.mff.cuni.cz>';
1019         store "=netinfo","log"       if headeris "Sender"   ,'<owner-netinfo-l@vol.cz>';
1020         store "=saintmj","log"       if headeris "From"     ,'<nagios@kam-enterprise.ms.mff.cuni.cz>';
1021         store "=saintmj","log"       if headeris "From"     ,'<nagios@kam.mff.cuni.cz>';
1022         store "=saintmj","log"       if headeris "From"     ,'<netsaint@kam.mff.cuni.cz>';
1023         store "=saintjk","log"       if headeris "From"     ,'<nagios@gw.jklabs.cz>';
1024         store "=saintjk","log"       if (headeris("From"     ,'<jklabs@manon.vellum.cz>')
1025                                       || headeris("From"     ,'<jklabs@ollie.vellum.cz>')
1026                                       || headeris("From"     ,'<nagios@jklabs.cz>'))
1027                                      && headeris("To"       ,'<jklabs-nagios@jankratochvil.net>');
1028         store "=4cerr","bell"        if headeris "From"     ,'<owner-4cinfo@atrey.karlin.mff.cuni.cz>';
1029         store "=4c","sms"            if headeris "List-Post",'<4cinfo@atrey.karlin.mff.cuni.cz>';
1030         store "=slashdot","bell"     if headeris "From"     ,'<slashdot@slashdot.org>';
1031         store "=freshmeat","bell"    if headeris "From"     ,'<noreply@freshmeat.net>';
1032         store "=sourceforge","bell"  if headeris "From"     ,'<noreply@sourceforge.net>';
1033         store "=gsmperlcvs","silent" if headeris("From"     ,'<johan@intra.tektonica.com>')
1034                                         && $Audit->subject()=~/^'.*' has been updated!$/;
1035         store "=libtoold","silent"   if headeris "List-Id"  ,'<libtool.gnu.org>';
1036         store "=libtoolpat","silent" if headeris "List-Id"  ,'<libtool-patches.gnu.org>';
1037         store "=automake","silent"   if headeris "List-Id"  ,'<automake.gnu.org>';
1038         store "=autoconf","log"      if headeris "List-Id"  ,'<autoconf.gnu.org>';
1039         store "=autoconfpat","log"   if headeris "List-Id"  ,'<autoconf-patches.gnu.org>';
1040         store "=hurd","log"          if headeris "List-Id"  ,'<l4-hurd.gnu.org>';
1041         store "=gccbug","silent"     if headeris "List-Post",'<gcc-bugs@gcc.gnu.org>';
1042         store "=gccann","log"        if headeris "List-Post",'<gcc-announce@gcc.gnu.org>';
1043         store "=gcc","silent"        if headeris "List-Post",'<gcc@gcc.gnu.org>';
1044         store "=gccpat","silent"     if headeris "List-Post",'<gcc-patches@gcc.gnu.org>';
1045         store "=ntfsann","silent"    if headeris "List-Id"  ,'<linux-ntfs-announce.lists.sourceforge.net>';
1046         store "=ntfsd","silent"      if headeris "List-Id"  ,'<linux-ntfs-dev.lists.sourceforge.net>';
1047         store "=orbit","silent"      if headeris "List-Id"  ,'<orbit-list.gnome.org>';
1048         store "=kannel","log"        if headeris "List-Id"  ,'<users.kannel.org>';
1049         store "=kanneld","log"       if headeris "List-Id"  ,'<devel.kannel.org>';
1050         store "=mailmand","silent"   if headeris "List-Id"  ,'<mailman-developers.python.org>';
1051         store "=asterisk-perl","log" if headeris "List-Post",'<asterisk-perl@lists.gnuinter.net>';
1052         store "=i4l","silent"        if headeris "List-Id"  ,'<isdn4linux.listserv.isdn4linux.de>';
1053         store "=glibc","silent"      if headeris "List-Post",'<libc-alpha@sourceware.org>';
1054         store "=fedann","bell"       if headeris "List-Id"  ,'<fedora-announce-list.redhat.com>';
1055         store "=fedpkg","bell"       if headeris "List-Id"  ,'<fedora-package-announce.redhat.com>';
1056         store "=fedtools","log"      if headeris "List-Id"  ,'<fedora-tools-list.redhat.com>';
1057         store "=fedd","log"          if headeris "List-Id"  ,'<fedora-devel-list.redhat.com>';
1058         store "=bashbug","log"       if headeris "List-Id"  ,'<bug-bash.gnu.org>';
1059         store "=zaurus","silent"     if headeris "List-Id"  ,'<openzaurus-users.lists.sourceforge.net>';
1060         store "=zaurusann","log"     if headeris "List-Id"  ,'<openzaurus-announce.lists.sourceforge.net>';
1061         store "=zaurusd","silent"    if headeris "List-Id"  ,'<openzaurus-devel.lists.sourceforge.net>';
1062         store "=zaurussoft","silent" if headeris "List-Id"  ,'<openzaurus-software.lists.sourceforge.net>';
1063         store "=iptperl","silent"    if headeris "List-Id"  ,'<iptperl-general.lists.sourceforge.net>';
1064         # own webs
1065         store "=energie","bell"      if headeris "From"     ,qr/^EnergieWeb/;
1066         store "=ats","log"           if headeris("From"     ,'<root@ms.atspraha.cz>')
1067                                         || (headeris("From",'<online@ringier.cz>') && headerhas("To",'<blesk@atspraha.cz>'));
1068         store "=atscasablanca","log" if headeris "From"     ,'<casablanca@ms.atspraha.cz>';
1069         store "=www-sms","log"       if headeris "List-Id"  ,'<www-sms-developers.lists.sourceforge.net>';
1070         store "=httpdd","log"        if headeris "list-post",'<dev@httpd.apache.org>';
1071         store "=mms2log","log"       if headeris "Return-Path",'<root@node0.mms2.org>';
1072         store "=hotelgatelog","log"  if headeris("Return-Path",'<root@hotelgate.hotelnet>')
1073                                                             # `SMART error' should not be matched.
1074                                      && headeris("Subject"  ,qr/^(?:Cron|Anacron|LogWatch) /);
1075         store "=imja","log"          if headeris "List-Id"  ,'<im-ja-devel.lists.sourceforge.net>';
1076         store "=wince","log"         if headeris "List-Post",'<wince@pandora.cz>';
1077         store "=mysqlperl","log"     if headeris "List-Id"  ,'<perl.mysql.com>';
1078         store "=whiteann","log"      if headeris "List-Id"  ,'<whitebox-announce.beau.org>';
1079         store "=white","log"         if headeris "List-Id"  ,'<whitebox-users.beau.org>';
1080         store "=centos","log"        if headeris "List-Id"  ,'<centos.centos.org>';
1081         store "=modperldoc","log"    if headeris "List-Id"  ,'<docs-dev.perl.apache.org>';
1082         store "=qemud","log"         if headeris "List-Id"  ,'<qemu-devel.nongnu.org>';
1083         store "=diamond","log"       if headeris "X-Replicator-Inst",'"www.diamondcard.us"';
1084         store "=soap","log"          if headeris "Sender"   ,'<owner-soap@DISCUSS.DEVELOP.COM>';
1085         store "=nagiosd","log"       if headeris "List-Id"  ,'<nagios-devel.lists.sourceforge.net>';
1086         store "=nagios","log"        if headeris "List-Id"  ,'<nagios-users.lists.sourceforge.net>';
1087         store "=grub","log"          if headeris "List-Id"  ,'<grub-devel.gnu.org>';
1088         store "=gdb","log"           if headeris "Mailing-List",'contact gdb-help@sourceware.org; run by ezmlm';
1089         store "=gdbpr","log"         if headeris "Mailing-List",'contact gdb-prs-help@sourceware.org; run by ezmlm';
1090         store "=gdbpat","log"        if headeris "Mailing-List",'contact gdb-patches-help@sourceware.org; run by ezmlm';
1091         store "=gdbann","log"        if headeris "Mailing-List",'contact gdb-announce-help@sourceware.org; run by ezmlm';
1092         store "=binutils","log"      if headeris "Mailing-List",'contact binutils-help@sourceware.org; run by ezmlm';
1093         store "=binutilsbug","log"   if headeris "List-Id"  ,'<bug-binutils.gnu.org>';
1094         store "=4c","bell"           if headeris "List-Id"  ,'<4c.jankratochvil.net>';
1095         store "=bezlucky","bell"     if headeris "List-Id"  ,'<bezlucky.jankratochvil.net>';
1096         store "=dup","log"           if headeris "List-Id"  ,'<duplicity-talk.nongnu.org>';
1097         store "=dupbug","log"        if headeris "List-Id"  ,'<duplicity-tracker.nongnu.org>';
1098         store "=eclipsetrader","log" if headeris "List-Id"  ,'<users-eclipsetrader.org>';
1099         store "=eclipsetraderd","log" if headeris "List-Id"  ,'<developers-eclipsetrader.org>';
1100         store "=sue","log"           if headeris "Subject"  ,'Cron <lace@manon> $HOME/secure/sue';
1101         store "=linkedin","log"      if headeris("From"     ,'<updates@linkedin.com>')
1102                                      || headeris("From"     ,'<linkedin@em.linkedin.com>');
1103         store "=jap","log"           if headeris("From"     ,'<japonstina@gmail.com>')
1104                                      && headeris("To"       ,'<japonstina@gmail.com>');
1105         store "=csa","log"           if headeris "From"     ,'<directmail@csa.cz>';
1106         store "=be2","log"           if headeris("From"     ,'<zakaznickyservis@be2.cz>')
1107                                      || headeris("From"     ,'<be2-czechia@email3.be2.com>');
1108
1109         # Petr Koutecky does not mark his Stuff
1110         store "=koutecky","log"      if headeris "Return-Path",'<velkyhroch@seznam.cz>';
1111         store "=koutecky","log"      if headeris "Return-Path",'<pk.petr@centrum.cz>';
1112         store "=koutecky","log"      if headeris "Return-Path",'<petr.koutecky@premisa.cz>';
1113         store "=koutecky","log"      if headeris "Return-Path",'<Petr.Koutecky@pr4.pm.ds.mfcr.cz>';
1114
1115         store "=host0log","log"      if headeris("From"       ,'<logwatch@jankratochvil.net>')
1116                                      && headeris("Return-Path",'<root@jankratochvil.net>');
1117         store "=host1log","log"      if headeris("From"       ,'<logwatch@host1.dyn.jankratochvil.net>')
1118                                      && headeris("Return-Path",'<root@host1.dyn.jankratochvil.net>');
1119         store "=jklabs","bell"       if headerhas "Received"   ,qr/\b\Qjan+lace.at.gw.priv.jklabs.cz\E@\Qjankratochvil.net\E\b/i;
1120         store "=financnik","log"     if headeris("Return-Path",'<postmaster@seznam.cz>')
1121                                      && headeris("From"       ,'<noreply@financnik.cz>')
1122                                      ## headeris("Subject"    ,qr/^Mini-magaz.*n serveru /); # It is B-MIME-encoded
1123                                      && body_simple()=~/\bMini-magaz.*n serveru Finan.*k[.]cz /;
1124         store "=financnik","log"     if headeris("Return-Path",'<postmaster@seznam.cz>')
1125                                      && headeris("From"       ,'<petr@financnik.cz>');
1126         store "=vps","bell"          if headeris "From"       ,'<@vps.jankratochvil.net>';
1127         store "=vps2","bell"         if headeris "From"       ,'<@vps2.jankratochvil.net>';
1128         store "=ib","bell"           if headeris("Return-Path",'<donotreply@interactivebrokers.com>')
1129                                      && headeris("Subject"    ,qr/^Interactive Brokers (?:Activity Statement (?:Notification )?|Daily Trade Report )for \d+$/);
1130         store "=ib","bell"           if (headeris("Return-Path",'<ibbounce@interactivebrokers.com>')
1131                                        ||headeris("Return-Path",'<noresponse@interactivebrokers.com>'))
1132                                       &&(headeris("Subject"    ,'Message Notification')
1133                                        ||headeris("Subject"    ,'IB FYI: Earnings Notification')
1134                                        ||headeris("Subject"    ,'IB FYI: Important information about Market Orders')
1135                                        ||headeris("Subject"    ,qr/^Interactive Brokers Webinars in /)
1136                                        ||headeris("Subject"    ,'IB FYI: Trades subject to US dividend tax withholding')
1137                                        ||headeris("Subject"    ,'IBKR FYI: Trades subject to US dividend tax withholding'));
1138         store "=odorik","log"        if headeris "Return-Path",'<watchdog@odorik.cz>';
1139         store "=zoohit","log"        if headeris("From"       ,'<akce@service.zoohit.cz>')
1140                                       ||headeris("From"       ,'<akce@service.zooplus.com>');
1141         store "=stockdaily","log"    if headeris "From"       ,'<support@dailyforexsystem.com>';
1142         store "=stockdaily","log"    if headeris "From"       ,'<Contact@shinysend.net>';
1143         store "=stockdaily","log"    if headeris "From"       ,'<signals@500signals.com>';
1144         store "=stockdaily","log"    if headeris "Return-Path",'<bounce@shinysend.net>';
1145         store "=stockdaily","log"    if headeris "From"       ,'<support@completeforexsignals.com>';
1146         store "=stockdaily","log"    if headeris "From"       ,'<support@shinysend.com>';
1147         store "=aostrading","log"    if headeris "From"       ,'<petr.tmej@aostrading.cz>';
1148         store "=shserver","log"      if headeris "Return-Path",'<root@sh.jklabs.new>';
1149         store "=rhbuildbot","log"    if headeris("Return-Path",'<jan@jankratochvil.net>')
1150                                       &&headeris("From"       ,'<jan@jankratochvil.net>')
1151                                       &&headeris("Subject"    ,'buildbot failure in LLVM on lldb-x86_64-fedora-28-cmake');
1152         store "=penzion","log"       if headeris "X-Original-To",'<@penzionspicak.cz>';
1153         store "=penzionbookingspam","log" if headeris "From"  ,'<email.campaign@sendgrid.net>';
1154         store "=penzion","log"       if headeris("Subject"    ,qr/Guest.House/) # qr/^Špičák Guest House - Performance on Google for /
1155                                       &&headeris("From"       ,'<googlemybusiness-noreply@google.com>');
1156         store "=greatergoodspam","log" if headeris "Return-Path",'<bounces@mailserv01.greatergood.com>';
1157         store "=padi","log"          if headeris "From"       ,'<@mail.padidiver.com>';
1158         store "=spamindiegogo","log" if headeris "From"       ,'<newsletter@indiegogo.com>';
1159         store "=cd","log"            if headeris "Return-Path",'<info@cd.cz>';
1160         store "=uptime","log"        if headeris "Return-Path",'<alert@uptimerobot.com>';
1161         store "=globus","log"        if headeris "From"       ,'<novinky@globusbonus.cz>';
1162         store "=spamgrab","log"      if headeris "From"       ,'<no-reply@grab.com>';
1163         store "=spamtoptal","log"    if headeris "From"       ,'<editor@toptal.com>';
1164         store "=pi","log"            if headeris "Return-Path",'<@piwifi18.jankratochvil.net>';
1165         store "=wedoslogin","log"    if headeris("Return-Path",'<no-reply@wedos.com>')
1166                                       &&headeris("Subject"    ,'=?UTF-8?B?V0VET1MgSW50ZXJuZXQgLSBwxZlpaGzDocWhZW7DrSBrIMO6xI10dQ==?='); # WEDOS Internet - přihlášení k účtu
1167         store "=ostc","log"          if headeris "Return-Path",'<mattermost@ostc-eu.org>';
1168         store "=apmail","log"        if headeris("Return-Path",'<lacemail@host1.jankratochvil.net>')
1169                                       &&headeris("To"         ,'<lacemail@host1.jankratochvil.net>')
1170                                       &&headeris("Subject"    ,'Cron <lacemail@host1> $HOME/bin/apmail');
1171         store "=spammobilede","log"  if headeris("Return-Path",'<bounce@info.mobile.de>')
1172                                       &&headeris("Subject"    ,qr/^\Q=?utf-8?B?8J+PhiBBdXNnZXfDpGhsdGUgVG9wLUZhaHJ6ZXVnZSBkZXIgVw==?=\E\s*\Q=?utf-8?B?b2NoZQ==?=\E$/); # 🏆 Ausgewählte Top-Fahrzeuge der Woche
1173         if (headeris("To"         ,'<lace@jankratochvil.net>')
1174          && headeris("Return-Path",'<nobody@tangens.sinus.cz>')) {
1175                 if (body_simple()=~/^SIP request received from <sip:2143[@]tangens.sinus.cz>.* for 2143$/o) {
1176                         store "=callme","log";
1177                 } else {
1178                         store "=call","log";
1179                 }
1180         }
1181         store "=odorik","log"        if headeris "Return-Path",'<monitoring@odorik.cz>';
1182
1183 #       {
1184 #               my $mailed=0;
1185 #               if ($Audit->header()!~/for <(?:4c|vmezihori1)-(?:admin|owner|bounces)@/) {
1186 #                       for my $list qw(mailman 4c) {
1187 #                               $mailed+=dolist $list;
1188 #                       }
1189 #               }
1190 #               # return if $mailed;
1191 #       }
1192
1193         store "=errm","bell"         if $isFROM_MAILER && !did()
1194                                      # qr/daemon@/ makes $isFROM_MAILER positive.
1195                                      && !headeris("From",'<bugzilla-daemon@bugzilla.gnome.org>')
1196                                      && !headeris("Resent-From",'<zrest@seznam.cz>');
1197
1198         if (!did) {
1199                 store "==","sms";
1200 # FIXME: What to do with it?
1201 ###             spamassassin "sa-learn --ham";
1202                 }
1203 }
1204
1205 sub audit_sms_address
1206 {
1207 my($obj)=@_;
1208
1209         my $address=$obj->address();
1210         if (my $alternates=muttrc_get("alternates")) {
1211                 return "I" if $address=~/$alternates/si;
1212                 }
1213         my %aliases=muttrc_aliases();
1214         if (my $alias=$aliases{lc $address}) {
1215                 local $_=$alias;
1216                 s/\b(Bus)siness$/$1/i;
1217                 s/\.ident$//i;
1218                 return $_;
1219                 }
1220         local $_=$address;
1221         s/\.cz$//i;
1222         return $_;
1223 }
1224
1225 # $args{"from"}
1226 # $args{"subject"}
1227 # $args{"body"}
1228 sub audit_sms
1229 {
1230 my(%args)=@_;
1231
1232         my $from=(@{$args{"from"}} ? join(",",map({ audit_sms_address($_); } @{$args{"from"}})) : "?");
1233         local $_;
1234
1235         $_=$args{"subject"};
1236         # headers
1237         s/(?:Re|Aw|Odp|Fw|Fwd|OT)(?:\[\d+\])?://ig;
1238         # former subject
1239         s/\bbylo:.*$//i;
1240         s/\[\s*WAS:.*\]\s*$//i;
1241         # trim
1242         s/^\s*//s;
1243         s/\s*$//s;
1244         my $subject=$_;
1245
1246         $_=$args{"body"};
1247         # max. 9 lines of .sig
1248         s/\n-- (?:\n[^\n]*){0,9}$//gs;
1249         # "Original Message"/"Puvodni zprava" etc. up to empty line
1250         # "- - - Original message: - - -" is by "Lotus Notes Release 5.0.5  September 22, 2000"
1251         s/(^|\n)[\s^\n]*(?:-----[\w\s]*-----|- - - Original message: - - -)[\s^\n]*(?:\n[^\n]+)*\n{2,}(?:\s*[^>\s].*$)?/\n/gs;
1252         # Remove "..." lines (is it used by anyone except me?)
1253         s/^\Q...\E$/*/gm;
1254         # quoting "> "
1255         s/^(?:\s*[[:upper:]]{0,3}>)+.*$/*/gm;
1256         s/(?:^|\n)(?:\*\n+)+/\n*\n/gs;
1257         # attributions
1258         s/^.*\b(?:wrote|writes|napsal jste):\s*$//gm;
1259         my $body=$_;
1260
1261         return [$from,"($subject)$body"];
1262 }
1263
1264 1;