Skip to content

Commit

Permalink
Ensure clean addresses are always used with Net::SMTP
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
robbat2 authored and Junio C Hamano committed Apr 26, 2007
1 parent c38f024 commit 2b69bfc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ sub send_message
}

my @sendmail_parameters = ('-i', @recipients);
my $raw_from = extract_valid_address($from);

if ($dry_run) {
# We don't want to send the email.
Expand All @@ -490,7 +491,7 @@ sub send_message
} 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;
Expand All @@ -501,10 +502,10 @@ sub send_message
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";
}
Expand Down

0 comments on commit 2b69bfc

Please sign in to comment.