[PATCH 7/9] Ensure clean addresses are always used with Net::SMTP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Robin H. Johnson <robbat2@xxxxxxxxxx>

Always pass in clean addresses to Net::SMTP for the MAIL FROM, and use them on
the SMTP non-quiet output as well.

Signed-off-by: Robin H. Johnson <robbat2@xxxxxxxxxx>
---
 git-send-email.perl |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 0e1cc16..82468bd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -479,6 +479,7 @@ X-Mailer: git-send-email $gitversion
 	}
 
 	my @sendmail_parameters = ('-i', @recipients);
+	my $raw_from = extract_valid_address($from);
 
 	if ($dry_run) {
 		# We don't want to send the email.
@@ -493,7 +494,7 @@ X-Mailer: git-send-email $gitversion
 	} else {
 		require Net::SMTP;
 		$smtp ||= Net::SMTP->new( $smtp_server );
-		$smtp->mail( $from ) or die $smtp->message;
+		$smtp->mail( $raw_from ) or die $smtp->message;
 		$smtp->to( @recipients ) or die $smtp->message;
 		$smtp->data or die $smtp->message;
 		$smtp->datasend("$header\n$message") or die $smtp->message;
@@ -504,10 +505,10 @@ X-Mailer: git-send-email $gitversion
 		printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
 	} else {
 		print (($dry_run ? "Dry-" : "")."OK. Log says:\nDate: $date\n");
-		if ($smtp) {
+		if ($smtp_server !~ m#^/#) {
 			print "Server: $smtp_server\n";
-			print "MAIL FROM: $from\n";
-			print "RCPT TO: ".join(',',@recipients)."\n";
+			print "MAIL FROM:<$raw_from>\n";
+			print "RCPT TO:".join(',',(map { "<$_>" } @recipients))."\n";
 		} else {
 			print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n";
 		}
-- 
1.5.2.rc0.43.g2f4c7

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]