X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/ba659b53059e637777865e646f0f2a6fb7f2988e..c6b8e3075d2fd6cd5ef345aa686a68cc899eb5fe:/selfforum-cgi/shared/Mail.pm?ds=sidebyside diff --git a/selfforum-cgi/shared/Mail.pm b/selfforum-cgi/shared/Mail.pm index e46a81c..8070704 100644 --- a/selfforum-cgi/shared/Mail.pm +++ b/selfforum-cgi/shared/Mail.pm @@ -18,14 +18,15 @@ use strict; package Mail; -use vars qw($mailbox $mailprog @ISA @EXPORT); +use vars qw($mailbox $mailprog @EXPORT); + +use autouse 'CheckRFC' => qw(is_email($)); # =================== # Funktionsexport # =================== -require Exporter; -@ISA = qw(Exporter); +use base qw(Exporter); @EXPORT = qw(is_mail_address send_mail); ######################################## @@ -41,7 +42,7 @@ require Exporter; ######################################## sub is_mail_address ($) { - return ($_[0] =~ /$mailbox/); + return is_email $_[0]; } ######################################## @@ -186,18 +187,12 @@ sub encode_qp ($) sub get_list ($$) { my ($start,$list)=splice @_; - my $string=""; - return "" unless (length($list)); - if (ref($list)) { - return "" unless (@$list); - foreach (@$list) { - $string.="$start: $_\n";}} - else { - $string="$start: $list\n";} + return $start . ': ' . $list . "\n" if (defined $list and not ref $list and length $list); - # Rueckgabe - $string; + return $start . ': ' . join (', ',@$list) . "\n" if (ref $list); + + ''; } ############################################## @@ -242,51 +237,9 @@ BEGIN { # =================================================================== $mailprog = '|/usr/lib/sendmail -t -oi'; - - # Thanx to J. Friedl for this regex: - - my ($address,$route_addr,$phrase,$addr_spec,$X,$phrase_char,$quoted_str,$comment,$word,$phrase_ctrl,$NonASCII, - $CloseBR,$OpenBR,$esc,$route,$domain,$local_part,$Period,$sub_domain,$domain_lit,$domain_ref,$quoted_pair, - $dtext,$atom,$qtext,$atom_char,$ctrl,$space,$tab,$CloseParen,$ctext,$Cnested,$OpenParen,$CRlist); - - $esc = '\\\\'; - $Period = '\.'; - $space = '\040'; - $tab = '\t'; - $OpenBR = '\['; - $CloseBR = '\]'; - $OpenParen = '\('; - $CloseParen = '\)'; - $NonASCII = '\x80-\xff'; - $ctrl = '\000-\037'; - $CRlist = '\n\015'; - $qtext = qq/[^$esc$NonASCII$CRlist\"]/; - $dtext = qq/[^$esc$NonASCII$CRlist$OpenBR$CloseBR]/; - $quoted_pair = qq< $esc [^$NonASCII] >; - $ctext = qq< [^$esc$NonASCII$CRlist()] >; - $Cnested = qq< $OpenParen $ctext* (?: $quoted_pair $ctext* )* $CloseParen >; - $comment = qq< $OpenParen $ctext* (?: (?: $quoted_pair | $Cnested ) $ctext* )* $CloseParen >; - $X = qq< [$space$tab]* (?: $comment [$space$tab]* )* >; - $atom_char = qq/[^($space)<>\@,;:\".$esc$OpenBR$CloseBR$ctrl$NonASCII]/; - $atom = qq< $atom_char+ (?!$atom_char) >; - $quoted_str = qq< \" $qtext * (?: $quoted_pair $qtext * )* \" >; - $word = qq< (?: $atom | $quoted_str ) >; - $domain_ref = $atom; - $domain_lit = qq< $OpenBR (?: $dtext | $quoted_pair )* $CloseBR >; - $sub_domain = qq< (?: $domain_ref | $domain_lit ) $X >; - $domain = qq< $sub_domain (?: $Period $X $sub_domain )* >; - $route = qq< \@ $X $domain (?: , $X \@ $X $domain )* : $X >; - $local_part = qq< $word $X (?: $Period $X $word $X )* >; - $addr_spec = qq< $local_part \@ $X $domain >; - $route_addr = qq[ < $X (?: $route )? $addr_spec > ]; - $phrase_ctrl = '\000-\010\012-\037'; - $phrase_char = qq/[^()<>\@,;:\".$esc$OpenBR$CloseBR$NonASCII$phrase_ctrl]/; - $phrase = qq< $word $phrase_char * (?: (?: $comment | $quoted_str ) $phrase_char * )* >; - $mailbox = qq< $X (?: $addr_spec | $phrase $route_addr ) >; - $mailbox = qr ~^$mailbox$~x; } -# making 'require' happy +# keeping require happy 1; #####################