4 # Copyright (C) 2002-2003 Jan Kratochvil <project-PerlMail@jankratochvil.net>
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.
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.
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
21 package PerlMail::Config;
22 use vars qw($VERSION);
23 $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
28 use vars qw(@ISA @EXPORT);
32 $Mail @ValidUsers $IdleMax $MaxBodySMS @SMSwebRcpt $SMSwebRcpt_username
33 $Lock_pathname $PeerAddr $Socket_timeout $DB_table $DBI_database $DBI_user $DBI_pwd
34 $sendmail_orig @addr_addon &FromAddress @h_rcpt @h_from
35 %audit_profile @sms_squeezes @alternates_host @dnsbl_whitelist
37 $Audit $is_pgp $opt_F $procmailFROM_MAILER $store_ignore $store_ignorenewmail
45 for (qw(headerhas store headeris did dnsbl store_muttrc_alternates Received_for parts_linear mime_type
46 body_first mimehead spamassassin header_remap lmtp_deliver)) {
47 eval 'sub '.$_.' { return ::'.$_.'(@_); }';
52 # perlmail-accept & perlmail-sendmail
54 # Various configuration files location is derived from it:
55 our $HOME="/home/lace";
61 our $Mail="$HOME/Mail";
62 # Users respected for the 'idle' state (see $IdleMax):
63 our @ValidUsers=qw(root lace short kratochvil _local);
64 # Maximum number of local console idle seconds while still considered as 'active user':
66 # Maxium number of bytes to pass to Lingua::EN::Squeeze (performance optimization):
67 our $MaxBodySMS=0x1000;
68 # Telephone number to send SMSes by WWW::SMS to:
69 our @SMSwebRcpt=qw(420 602 431329);
70 # Some WWW::SMS modules require username:
71 our $SMSwebRcpt_username="lace2";
72 our $lmtp_admin="cyrus";
76 open F,"$HOME/priv/lmtp.${lmtp_admin}.pwd" or die;
81 our $lmtp_user_from="lace";
82 our $lmtp_user_to="lacemail";
87 # Global system lock for exclusive $DB_table access:
88 our $Lock_pathname="/tmp/PerlMail.lock";
89 # 'workstation' hostname and port. Hostname may be dyndns:
90 our $PeerAddr="exuhome.dyn.jankratochvil.net.:852";
91 #our $PeerAddr="127.0.0.1:2852";
92 # 15sec is NOT enough as the remote peer must complete mail store:
93 our $Socket_timeout=7600;
95 our $DB_table="PerlMail_folder";
96 # MySQL database name:
97 our $DBI_database="short";
99 our $DBI_user="short";
100 # MySQL user password:
101 our $DBI_pwd=$HOME."/priv/mysql.".$DBI_user.".pwd";
106 # Lists where <rcpt-USER.AT.HOST@jankratochvil.net> address is generated:
108 tacplus-l@disaster.com
113 ros-general@reactos.com
114 ros-kernel@reactos.com
117 4cinfo@atrey.karlin.mff.cuni.cz
119 libtool-patches@gnu.org
120 wine-license@winehq.org
121 gtk-devel-list@gnome.org
122 gnome-vfs-list@gnome.org
123 captive-announce-list@jankratochvil.net
124 captive-list@jankratochvil.net
125 captive-devel-list@jankratochvil.net
126 linux-ntfs-announce@lists.sourceforge.net
127 linux-ntfs-dev@lists.sourceforge.net
132 autoconf-patches@gnu.org
133 wget-patches@sunsite.dk
138 asterisk-perl@lists.gnuinter.net
139 isdn4linux@listserv.isdn4linux.de
140 libc-alpha@sources.redhat.com
141 squid-dev@squid-cache.org
145 # Pathname of the original sendmail(8) binary:
146 our $sendmail_orig=(-x ($_="/usr/sbin/sendmail-orig") ? $_ : "/usr/sbin/sendmail");
147 # List of addresses to locally Bcc all mails to:
148 # Mail-Alias-1.12 defaults to "/etc/mail/aliases" which does not exist on RedHat sendmail-8.12.5-7
149 # Mail-Alias-1.12 will clutter $_ !
150 our @addr_addon=(Mail::Alias->new("/etc/aliases")->exists("sentout") ? ("sentout") : ());
152 our $opt_F; # imported
153 our $is_pgp; # imported
154 my %lists=map(($_=>1),@lists);
155 # Generate new From address for the target $rcpt of type Mail::Address.
156 # $iserror is true for "MAIL FROM" RFC821 address, false for "From:" RFC822 address.
157 # Returns: Mail::Address instance.
160 my($rcpt,$iserror)=@_;
162 my $phrase=(defined $opt_F ? $opt_F : "Jan Kratochvil");
168 my $filename="$HOME/.gnupg/options";
169 open F,$filename or do { warn "Open \"$filename\": $!"; last; };
171 my @keys=map((/^\s*default-key\s+(\S+)\s*$/),<F>);
172 @keys==1 or do { warn "Found ".scalar(@keys)." 'default-key's in your \"$filename\", ignoring"; last; };
173 close F or warn "Close \"$filename\": $!";
174 my $default_key=$keys[0];
175 $default_key=~/^[[:xdigit:]]{8}$/ or do { warn "Invalid 'default-key', ignoring: $default_key"; last; };
176 return Mail::Address->new(
178 'pgp-'.uc($default_key).'@jankratochvil.net',
181 return Mail::Address->new($phrase,'lace@jankratochvil.net') if !$lists{$rcpt->address()};
182 return Mail::Address->new(
186 .(defined($rcpt->user()) ? $rcpt->user() : "NOUSER")
188 .(defined($rcpt->host()) ? $rcpt->host() : "LOCAL")
189 .'@jankratochvil.net',
193 # RedHat sendmail-8.9.3-20/src/conf.c/HdrInfo[]/\Q/* destination fields */\E
194 # FIXME: Recognize "Resent-$_" headers for -t but when we are in 'resent' mode?
195 our @h_rcpt=( # case in-sensitive!
201 # ordering matters; first header found is substituted
202 # last header is subsituted if no one is found
211 # Setup profile names.
212 # First element of /^=/ form copies it referenced profile to be extended.
213 # 'did' =>did() subroutine will return true for it.
214 # 'syslog' =>Use syslog(3).
215 # 'bell' =>Bell sound.
216 # 'sms=\d+'=>Send SMS by WWW::SMS with specified maximum # of parts
219 "silent"=>["=btw" ,"did"],
220 "log" =>["=silent","syslog"],
221 "bell" =>["=log" ,"bell"],
222 "sms" =>["=bell" ,"sms=1"],
223 "crit" =>["=sms" ,"sms=3"],
225 # Try the squeezing methods in this order:
227 { "SqueezeControl"=>"noconv" },
228 { "SqueezeControl"=>"conv" ,"SQZ_OPTIMIZE_LEVEL"=>0 },
229 { "SqueezeControl"=>"conv" ,"SQZ_OPTIMIZE_LEVEL"=>1 },
230 { "SqueezeControl"=>"med" ,"SQZ_OPTIMIZE_LEVEL"=>0 },
231 { "SqueezeControl"=>"med" ,"SQZ_OPTIMIZE_LEVEL"=>1 },
232 { "SqueezeControl"=>"max" ,"SQZ_OPTIMIZE_LEVEL"=>0 },
233 { "SqueezeControl"=>"max" ,"SQZ_OPTIMIZE_LEVEL"=>1 },
235 # Hostnames where we had alternate e-mail addresses:
236 our @alternates_host=(
237 "jabberwock.ucw.cz", # short@ucw.cz
238 "atrey.karlin.mff.cuni.cz", # short@atrey.karlin.mff.cuni.cz
239 "k332.feld.cvut.cz", # short@k332.feld.cvut.cz
241 # Override DNS blacklists:
242 our @dnsbl_whitelist=(
243 "195.250.128.83", # smtp3.vol.cz; vol.cz.multistage.blackholes.five-ten-sg.com.
244 "64.49.222.22", # mail.pm.org: rackspace.com.spam-support.blackholes.five-ten-sg.com.
245 "208.147.243.5", # gambit.liquidcomm.net: cw.net.spam-support.blackholes.five-ten-sg.com.
246 "213.235.135.70", # smtp.tiscali.cz: tiscali.cz.multistage.blackholes.five-ten-sg.com.
247 "205.139.198.11", # eniac.disaster.com: cw.net.spam-support.blackholes.five-ten-sg.com.
248 "127.0.0.2", # 2.0.0.127.relays.ordb.org.
249 "65.113.40.131", # bozo.vmware.com: qwest.net.spam-support.blackholes.five-ten-sg.com.
250 "66.218.85.33", # mta2.wss.scd.yahoo.com: yahoo.com.spam.blackholes.five-ten-sg.com.
251 "212.80.76.42", # mx2.seznam.cz: seznam.cz.free.blackholes.five-ten-sg.com.
252 "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.
253 "212.80.76.44", # mx1.seznam.cz: 44.76.80.212.blackholes.five-ten-sg.com.
254 "212.80.76.29", # prace.seznam.cz: 212.80.76.42.seznam.cz.free.blackholes.five-ten-sg.com
255 "193.252.22.30", # smtp1.wanadoo.fr: 30.22.252.193.blackholes.five-ten-sg.com
256 "213.151.87.16", # posta.dobnet.cz: 16.87.151.213.relays.ordb.org
259 our $Audit; # imported
260 our $procmailFROM_MAILER; # imported
261 our $store_ignorenewmail; # imported
262 our $store_profile; # imported
263 our $store_ignore; # imported
266 $store_profile=undef();
268 # never spawn new mail if FROM_MAILER
269 # $isFROM_MAILER postponed after maillists as they may look as FROM_MAILER
271 my $isFROM_MAILER=$Audit->header()=~/$procmailFROM_MAILER/mio;
272 $store_ignorenewmail=(0
274 || headerhas "From",'<Regexp:^owner->'
280 # Do not local $store_file as it is our-imported
281 $store_profile="silent";
282 store "=spam" if grep /^\Qshort\@k332.feld.cvut.cz\E/i,Received_for();
283 # TODO: foreign violation of RFC 822 section 4.4.4, Subject:.*Automatick.+odpov.+v.+nep.+tomnosti
284 store "=spam" if headeris "From",'<ghandchi@hotmail.com>';
285 store "=spam" if headeris "From",'<newsletter@levnapc.cz>';
286 store "=spam" if headeris "From",'<Tomas@dtpstudio.cz>';
287 store "=spam" if headeris "From",'<BNcom@email.bn.com>';
288 store "=spam" if headeris "From",'<e4luck@lists.opt4email.com>';
289 store "=spam" if headeris "From",'<mailcontests@lists.servitall.com>';
290 store "=spam" if headeris "From",'<canda@lica.cz>';
292 # weak detection: files with text/html w/o text/plain are usually a spam
293 my @types_linear=map({ mime_type($_); } parts_linear());
294 store "=spam" if grep({ $_ eq "text/html"; } @types_linear) && !grep({ $_ eq "text/plain"; } @types_linear);
296 store "=spam" if ($_=mimehead(body_first())->mime_attr("Content-Type.charset")) && /^big5/i;
298 $store_profile=undef();
302 # Do not local $store_file as it is our-imported
303 $store_profile="silent";
305 store "=spam".($_ eq 1 ? "" : ";$_") if $_=spamassassin();
307 $store_profile=undef();
309 # Do not local $store_file as it is our-imported
310 $store_profile="silent";
312 store "=spam" .";$_","log" if $_=dnsbl '.relays.ordb.org.' ,1; # all hosts
313 store "=spam" .";$_","log" if $_=dnsbl '.blackholes.mail-abuse.org.' ,1; # all hosts
314 # we don't check all hosts as they can be "dialup" category, FIXME: check for it
315 # store "=spam" .";$_","log" if $_=dnsbl '.blackholes.five-ten-sg.com.',0; # just first
316 # I don't send viruses but viruses propagate mails of mine
317 store "=spam" if headeris "X-Mailer",'ravmd/8.3.2';
318 store "=spam" if $isFROM_MAILER && headeris("To",'<short@ucw.cz>');
320 $store_profile=undef();
323 store "=err","bell" and return if headerhas \&Received_for,'<short+err@>';
325 # ppl-wished foreign remapping, Reply-To is left untouched!
326 # FIXME: modifications are now being dropped by &write_message!
327 header_remap("From",{
328 'kerere@post.cz' =>'kamzik@k332.feld.cvut.cz',
329 'profes@mbox.vol.cz' =>'kratochvilova@egp.cz',
330 'jkrouzek@mbox.vol.cz' =>'krouzek@mbox.fsv.cuni.cz',
331 'jakub.gorner@lidovky.cz' =>'tonda@disnet.cz',
332 'jan.kolar@videoprogress.cz' =>'jenda.kolar@volny.cz',
333 'daniel.rulicek@cponline.cz' =>'daniel.rulicek@cpress.cz',
334 'pavel@suse.cz' =>'pavel@ucw.cz',
337 # My obsolete e-mail addresses
338 store_muttrc_alternates "=redirect-","btw";
340 # nasty public lists with $store_ignore
342 # Do not local $store_file as it is our-imported
343 $store_profile="log";
345 $store_ignore="smsmail" if 1==$Audit->body() && length(join "",$Audit->body())<180; # SMS mail
346 $store_ignore="sms OS" if $Audit->subject()=~/^Email pro: /; # "^Email pro: gsm@sh\.cvut\.cz$";
347 $store_ignore="list-moron" if grep { headeris "From",$_; } qw(
353 <satko@quanto.nr.sanet.sk>
354 <vithous@attorney.cz> <viroman@attorney.cz>
360 store "=gsm" if headeris "Sender" ,'<owner-gsm@sh.cvut.cz>';
361 store "=gsmpand" if headeris "List-Post",'<gsm@pandora.cz>';
362 store "=9kc","log" if headeris "List-Post",'<n9k@pandora.cz>';
363 store "=9kcd","log" if headeris "List-Post",'<dev9k@pandora.cz>';
365 $store_profile=undef();
368 store "=mozillabug","log" if headeris "From" ,'<bugzilla-daemon@mozilla.org>';
369 store "=9ku","log" if headeris "List-Id" ,'<9000.listman.net>';
370 store "=9kd","log" if headeris "Sender" ,'<owner-9000-developers@geekstuff.co.uk>';
371 store "=spong","log" if headeris "List-Id" ,'<spong-users.lists.sourceforge.net>';
372 store "=gtkd","silent" if headeris "List-Id" ,'<gtk-devel-list.gnome.org>';
373 store "=gnomevfs","log" if headeris "List-Id" ,'<gnome-vfs-list.gnome.org>';
374 store "=mffstatnice","bell" if headeris "List-Post",'<statnice@atrey.karlin.mff.cuni.cz>';
375 store "=hw","log" if headeris "List-Post",'<hw-news@list.gin.cz>';
376 store "=gnokii","log" if headeris "List-Id" ,'<gnokii-users.mail.freesoftware.fsf.org>';
377 store "=winelic","silent" if headeris "List-Id" ,'<wine-license.winehq.org>';
378 store "=wined","silent" if headeris "List-Id" ,'<wine-devel.winehq.org>';
379 store "=winepat","silent" if headeris "List-Id" ,'<wine-patches.winehq.org>';
380 store "=winecvs","silent" if headeris "List-Id" ,'<wine-cvs.winehq.org>';
381 store "=wineann","silent" if headeris "List-Id" ,'<wine-announce.winehq.org>';
382 store "=wineconf","silent" if headeris "List-Id" ,'<wineconf.winehq.org>';
383 store "=ros","silent" if headeris "List-Id" ,'<ros-general.reactos.com>';
384 store "=roskernel","silent" if headeris "List-Id" ,'<ros-kernel.reactos.com>';
385 store "=rosd","silent" if headeris "List-Id" ,'<ros-dev.reactos.com>';
386 store "=roscvs","silent" if headeris "List-Id" ,'<ros-cvs.reactos.com>';
387 store "=rossvn","silent" if headeris "List-Id" ,'<ros-svn.reactos.com>';
388 store "=rosbug","silent" if headeris "Reply-To" ,'<scarab@reactos.wox.org>';
389 store "=fsd","silent" if headeris "X-Mailing-List",'<linux-fsdevel@vger.kernel.org>';
390 store "=kernel","silent" if headeris "X-Mailing-List",'<linux-kernel@vger.kernel.org>';
391 store "=kernelnet","silent" if headeris "X-Mailing-List",'<linux-net@vger.kernel.org>';
392 store "=ia64","silent" if headeris "X-Mailing-List",'<linux-ia64@vger.kernel.org>';
393 store "=linuxjap","silent" if headeris "X-Mailing-List",'<linux-japanese@vger.kernel.org>';
394 store "=kernelann","silent" if headeris "X-Mailing-List",'<linux-kernel-announce@vger.kernel.org>';
395 store "=sparse","silent" if headeris "X-Mailing-List",'<linux-sparse@vger.kernel.org>';
396 store "=smp","silent" if headeris "X-Mailing-List",'<linux-smp@vger.kernel.org>';
397 store "=surprise","sms" if headeris "List-Post",'<surprise@atrey.karlin.mff.cuni.cz>';
398 store "=surprisesuse","sms" if headeris "Sender" ,'<owner-surprise@suse.cz>';
399 store "=tacacs","silent" if headeris "Sender" ,'<tacplus-l@disaster.com>';
400 store "=tacacs","silent" if headeris "Sender" ,'<owner-tacplus-l@disaster.com>';
401 store "=tacacs","silent" if headeris "List-Id" ,'<devel.lists.tacplus.org>';
402 store "=pm","log" if headeris "Sender" ,'<owner-prague-pm@pm.org>';
403 store "=radary","log" if headeris "Reply-To" ,'<pha@radary.cz>';
404 store "=dnet","log" if headeris "Sender" ,'<@lists.distributed.net>';
405 store "=linux-input","log" if headeris "List-Post",'<linux-input@atrey.karlin.mff.cuni.cz>';
406 store "=strom","bell" if headeris "List-Post",'<vodni-strom@atrey.karlin.mff.cuni.cz>';
407 store "=netinfo","log" if headeris "Sender" ,'<owner-netinfo-l@vol.cz>';
408 store "=saintmj","log" if headeris "From" ,'<netsaint@kam-enterprise.ms.mff.cuni.cz>';
409 store "=saintmj","log" if headeris "From" ,'<netsaint@kam.mff.cuni.cz>';
410 store "=4cerr","bell" if headeris "From" ,'<owner-4cinfo@atrey.karlin.mff.cuni.cz>';
411 store "=4c","sms" if headeris "List-Post",'<4cinfo@atrey.karlin.mff.cuni.cz>';
412 store "=slashdot","bell" if headeris "From" ,'<slashdot@slashdot.org>';
413 store "=freshmeat","bell" if headeris "From" ,'<noreply@freshmeat.net>';
414 store "=sourceforge","bell" if headeris "From" ,'<noreply@sourceforge.net>';
415 store "=gsmperlcvs","silent" if headeris("From" ,'<johan@intra.tektonica.com>')
416 && $Audit->subject()=~/^'.*' has been updated!$/;
417 store "=libtoold","silent" if headeris "List-Id" ,'<libtool.gnu.org>';
418 store "=libtoolpat","silent" if headeris "List-Id" ,'<libtool-patches.gnu.org>';
419 store "=automake","silent" if headeris "List-Id" ,'<automake.gnu.org>';
420 store "=autoconf","log" if headeris "List-Id" ,'<autoconf.gnu.org>';
421 store "=autoconfpat","log" if headeris "List-Id" ,'<autoconf-patches.gnu.org>';
422 store "=hurd","log" if headeris "List-Id" ,'<l4-hurd.gnu.org>';
424 '<captive-admin@>'=>"=caperr",
425 '<captive-devel-admin@>'=>"=caperr",
426 '<captive-announce-admin@>'=>"=caperr",
427 '<4c-admin@>'=>"=4cerr",
430 while ((my($mailaddr,$folder)=each(%mailman))) {
431 (my $maillistaddr=$mailaddr)=~s/-admin/-list$&/;
432 store $folder,"log" if (headeris("From",'<mailman-owner@vellum.cz>')&&headeris("To",$mailaddr))
433 || headeris("From",$maillistaddr)
434 || headeris("To",$maillistaddr)
435 || headeris("From",$mailaddr);
438 store "=cap","bell" if headeris "List-Id" ,'<captive-list.jankratochvil.net>';
439 store "=capd","bell" if headeris "List-Id" ,'<captive-devel-list.jankratochvil.net>';
440 store "=capann","bell" if headeris "List-Id" ,'<captive-announce-list.jankratochvil.net>';
441 store "=4c","bell" if headeris "List-Id" ,'<4c-list.vellum.cz>';
443 store "=ntfsann","silent" if headeris "List-Id" ,'<linux-ntfs-announce.lists.sourceforge.net>';
444 store "=ntfsd","silent" if headeris "List-Id" ,'<linux-ntfs-dev.lists.sourceforge.net>';
445 store "=orbit","silent" if headeris "List-Id" ,'<orbit-list.gnome.org>';
446 store "=kand","log" if headeris "List-Id" ,'<devel.kannel.org>';
447 store "=mailmand","silent" if headeris "List-Id" ,'<mailman-developers.python.org>';
448 store "=asterisk-perl","log" if headeris "List-Post",'<asterisk-perl@lists.gnuinter.net>';
449 store "=i4l","silent" if headeris "List-Id" ,'<isdn4linux.listserv.isdn4linux.de>';
450 store "=glibc","silent" if headeris "Mailing-List",qr/\b\Qlibc-alpha-help\E@\Qsources.redhat.com\E\b/;
451 store "=fedann","bell" if headeris "List-Id" ,'<fedora-announce-list.redhat.com>';
452 store "=fedtools","log" if headeris "List-Id" ,'<fedora-tools-list.redhat.com>';
453 store "=bashbug","log" if headeris "List-Id" ,'<bug-bash.gnu.org>';
455 store "=energie","bell" if headeris "From" ,qr/^EnergieWeb/;
456 store "=ats","log" if headeris("From" ,'<root@ms.atspraha.cz>')
457 || (headeris("From",'<online@ringier.cz>') && headerhas("To",'<blesk@atspraha.cz>'));
458 store "=atscasablanca","log" if headeris "From" ,'<casablanca@ms.atspraha.cz>';
459 store "=www-sms","log" if headeris "List-Id" ,'<www-sms-developers.lists.sourceforge.net>';
460 store "=httpdd","log" if headeris "list-post",'<dev@httpd.apache.org>';
461 store "=mms2log","log" if headeris "Return-Path",'<root@node0.mms2.org>';
462 store "=hotelgatelog","log" if headeris "Return-Path",'<root@hotelgate.hotelnet>';
464 # Petr Koutecky does not mark his Stuff
465 store "=koutecky","log" if headeris "Return-Path",'<velkyhroch@seznam.cz>';
466 store "=koutecky","log" if headeris "Return-Path",'<pk.petr@centrum.cz>';
467 store "=koutecky","log" if headeris "Return-Path",'<petr.koutecky@premisa.cz>';
469 if (($isFROM_MAILER && !did) || !did) {
470 lmtp_deliver $lmtp_admin,$lmtp_pwd,$lmtp_user_from,$lmtp_user_to;
473 store "=errm","bell" if $isFROM_MAILER && !did();
477 spamassassin "$HOME/bin/sa-learn --ham";
481 sub audit_sms_address
485 my $address=$obj->address();
486 if (my $alternates=muttrc_get("alternates")) {
487 return "I" if $address=~/$alternates/si;
489 my %aliases=muttrc_aliases();
490 if (my $alias=$aliases{lc $address}) {
492 s/\b(Bus)siness$/$1/i;
508 my $from=(@{$args{"from"}} ? join(",",map({ audit_sms_address($_); } @{$args{"from"}})) : "?");
513 s/(?:Re|Aw|Odp|Fw|Fwd|OT)(?:\[\d+\])?://ig;
516 s/\[\s*WAS:.*\]\s*$//i;
523 # max. 9 lines of .sig
524 s/\n-- (?:\n[^\n]*){0,9}$//gs;
525 # "Original Message"/"Puvodni zprava" etc. up to empty line
526 # "- - - Original message: - - -" is by "Lotus Notes Release 5.0.5 September 22, 2000"
527 s/(^|\n)[\s^\n]*(?:-----[\w\s]*-----|- - - Original message: - - -)[\s^\n]*(?:\n[^\n]+)*\n{2,}(?:\s*[^>\s].*$)?/\n/gs;
528 # Remove "..." lines (is it used by anyone except me?)
531 s/^(?:\s*[[:upper:]]{0,3}>)+.*$/*/gm;
532 s/(?:^|\n)(?:\*\n+)+/\n*\n/gs;
534 s/^.*\b(?:wrote|writes|napsal jste):\s*$//gm;
537 return [$from,"($subject)$body"];