X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/4a48147439aaea9f8e753d7cc37b38733d60bdd5..50ab72c5b8dbaca93b2bf52e4543861d878d60fb:/selfforum-cgi/shared/Mail.pm?ds=inline diff --git a/selfforum-cgi/shared/Mail.pm b/selfforum-cgi/shared/Mail.pm index 73166c9..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]; } ######################################## @@ -236,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; #####################