diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2007-04-25 19:37:21 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-25 21:12:16 -0700 |
commit | 2b69bfc23d89d2ec5507bc6906b533e8429b313d (patch) | |
tree | 36285a910b228be758b25881d42f15616ee2436f /git-send-email.perl | |
parent | c38f0247a88f2c54c0c8535d645f33140201522f (diff) | |
download | git-2b69bfc23d89d2ec5507bc6906b533e8429b313d.tar.gz |
Ensure clean addresses are always used with Net::SMTP
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@gentoo.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-x | 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 b602292904..35c4722a15 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -476,6 +476,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. @@ -490,7 +491,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; @@ -501,10 +502,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"; } |