[vhffs-dev] [892] handle dot on a file by itself with batched smtp ( and rewrote this horrible get_mail_from_stdin function )

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


Revision: 892
Author:   gradator
Date:     2007-09-10 02:52:57 +0000 (Mon, 10 Sep 2007)

Log Message:
-----------
handle dot on a file by itself with batched smtp (and rewrote this horrible get_mail_from_stdin function )

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


Modified: trunk/vhffs-listengine/src/listengine.pl
===================================================================
--- trunk/vhffs-listengine/src/listengine.pl	2007-09-10 02:18:21 UTC (rev 891)
+++ trunk/vhffs-listengine/src/listengine.pl	2007-09-10 02:52:57 UTC (rev 892)
@@ -1043,27 +1043,21 @@
 ###############
 sub fetch_mail_from_stdin
 {    
-    my @mail;
-    my $passed;
-    my $line;
-    $passed = 0;
-    while( $line = <STDIN> )
-    {
-	if( $passed == 0 )
-	{
-	    if( $line =~ /^[a-zA-Z0-9\-]+:\s.+$/ )
-	    {
-		$passed = 1;
-		push( @mail , $line );
-	    }
+	my @mail;
+	my $line;
+
+	# Wait for header
+	while( $line = <STDIN> )  {
+		last if( $line =~ /^[a-zA-Z0-9\-]+:\s.+$/ );
 	}
-	else
-	{
-	    push( @mail , $line );
-	}
-    }
-    my $m = Mail::Internet->new( \@mail );
-    return $m;
+
+	do {
+		# handle dot on a line by itself if using batched smtp
+		$line = '.'.$line if( defined $SENDMAIL_PATH  &&  $line =~ /^\./ );
+		push( @mail , $line );
+	}  while( $line = <STDIN> );
+
+	return Mail::Internet->new( \@mail );
 }
 
 sub fetch_mail_from_file


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