[vhffs-dev] [1381] relaxed From: checks, existing if the the incoming mail doesn' t have a From: header

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1381
Author:   gradator
Date:     2009-03-16 17:36:40 +0100 (Mon, 16 Mar 2009)

Log Message:
-----------
relaxed From: checks, existing if the the incoming mail doesn't have a From: header

Modified Paths:
--------------
    trunk/vhffs-listengine/src/listengine.pl


Modified: trunk/vhffs-listengine/src/listengine.pl
===================================================================
--- trunk/vhffs-listengine/src/listengine.pl	2009-03-16 12:29:33 UTC (rev 1380)
+++ trunk/vhffs-listengine/src/listengine.pl	2009-03-16 16:36:40 UTC (rev 1381)
@@ -143,16 +143,13 @@
 		unlink $errorf if ( -f $errorf  &&  ! -s $errorf );
 	}
 	else {
-		my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([\.a-zA-Z_\-0-9^\s]+)\.(\w+))/);
-		$from = lc $from;
-
 		foreach my $adr (@tos)
 		{
 			my $smtp = Net::SMTP->new( $SMTP_SERVER,
 				Hello => $DOMAIN,
 			);
 
-			$smtp->mail( $from );
+			$smtp->mail( $LISTMASTER );
 			$smtp->to( $adr );
 			$smtp->data( $mail->as_string );
 			$smtp->quit;
@@ -197,7 +194,7 @@
     my $header;
     my $email;
     my ( $message_id  ) =  ($mail->get( 'Message-Id' ) =~ /<(.+)>/);
-    my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([\.a-zA-Z_\-0-9^\s]+)\.(\w+))/);
+    my ( $from ) = ( $mail->get('From') =~ /([^\s^<]+@[^>^\s]+)/);
     $from = lc $from;
     my $directory = get_moderation_dir( $list );
     my $subject = $mail->get('Subject');
@@ -816,7 +813,7 @@
     my $mail = shift;
     my $list = shift;
 
-    my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([\.a-zA-Z_\-0-9^\s]+)\.(\w+))/);
+    my ( $from ) = ( $mail->get('From') =~ /([^\s^<]+@[^>^\s]+)/);
     $from = lc $from;
     my $subject = $mail->get('Subject');
     my $action;
@@ -1107,7 +1104,7 @@
 sub get_lang
 {
     my $mail = shift;
-    my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([\.a-zA-Z_\-0-9^\s]+)\.(\w+))/);
+    my ( $from ) = ( $mail->get('From') =~ /([^\s^<]+@[^>^\s]+)/);
     $from = lc $from;
 
     my $lang = Vhffs::Services::MailingList::get_language_for_sub( $vhffs , $from );
@@ -1127,15 +1124,15 @@
 ##############################
 sub verify_mail_with_list
 {
-        my $list = shift;
-        my $mail = shift;
+	my $list = shift;
+	my $mail = shift;
 
-	my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([\.a-zA-Z_\-0-9^\s]+)\.(\w+))/);
+	my ( $from ) = ( $mail->get('From') =~ /([^\s^<]+@[^>^\s]+)/);
 	$from = lc $from;
 
-        my $temp = $list->get_localpart."-request\@".$list->get_domain;
-        exit( 0 ) if( $from eq $list->get_listname);
-        exit( 0 ) if( $from eq $temp);
+	exit( 0 ) unless defined $from;
+	exit( 0 ) if( $from eq $list->get_listname);
+	exit( 0 ) if( $from eq $list->get_localpart.'-request@'.$list->get_domain );
 }
 
 
@@ -1155,7 +1152,7 @@
 
 #Build the list object from VHFFS
 my $list = Vhffs::Services::MailingList::get_by_mladdress( $vhffs , $lpart , $domain );
-exit( 0 ) if(!defined $list);
+exit( 0 ) unless defined $list;
 
 
 verify_mail_with_list( $list , $mail );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/