X-Git-Url: http://git.jankratochvil.net/?p=PerlMail.git;a=blobdiff_plain;f=perlmail-sendmail;h=276e3ddb44d70f9408cc3d96d609022ff835081e;hp=c84847ddfc7de359bbe098c2040e177dfeb67600;hb=e19b6c0e412149c689a0e09deb410911b0b1d6a3;hpb=be8e1bc69e15a29e52d8bbcde5971214a5b8340b diff --git a/perlmail-sendmail b/perlmail-sendmail index c84847d..276e3dd 100755 --- a/perlmail-sendmail +++ b/perlmail-sendmail @@ -59,8 +59,7 @@ my $opt_b; my $opt_Q; my $opt_q; my $opt_t; -our $opt_f; -our $opt_F; # from PerlMail::Config; +our $opt_f; # not exported, just for local() my $opt_perlmail_dry_run; my @ARGV_save=@ARGV; # for non-bm mode die if !Getopt::Long::GetOptions( @@ -126,7 +125,6 @@ my $from_headername; } # to be utilized later by &FromAddress -our $is_pgp; # from PerlMail::Config; $is_pgp=(1 && do { local $_=$head->mime_attr("Content-Type"); $_ && ~m#^multipart/(?:signed|encrypted)$#; } && do { local $_=$head->mime_attr("Content-Type.protocol"); $_ && ~m#^application/pgp\b#; } @@ -155,7 +153,11 @@ for my $rcpt (@rcpts) { if (defined $rcpt) { # !defined($rcpt) if we have no recipients local $_; $opt_f=FromAddress($rcpt,1)->address() if !defined $opt_f; - $head->replace($from_headername,FromAddress($rcpt,0)->format()) if $from_headername; + if ($from_headername) { + if (my $fromaddr=FromAddress($rcpt,0)->format()) { + $head->replace($from_headername,$fromaddr); + } + } } 1; # drop '-bm' if present as it is default anyway