summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7cf48d1)
- defaults to system alias "sentout" (if exists)
Fixed "From" filling if no From-style headers exist
Fixed missing header<->body newline delimiter (it worked?)
require Mail::Header;
require Mail::Address;
require File::Basename;
require Mail::Header;
require Mail::Address;
require File::Basename;
my $sendmail_orig=(-x ($_="/usr/sbin/sendmail-orig") ? $_ : "/usr/sbin/sendmail");
my $HOME="/home/short";
my $sendmail_orig=(-x ($_="/usr/sbin/sendmail-orig") ? $_ : "/usr/sbin/sendmail");
my $HOME="/home/short";
+# Mail-Alias-1.12 defaults to "/etc/mail/aliases" which does not exist on RedHat sendmail-8.12.5-7
+my @addr_addon=(Mail::Alias->new("/etc/aliases")->exists($_="sentout") ? ($_) : ());
my $opt_F;
sub FromAddress
{
my $opt_F;
sub FromAddress
{
my $muttrc_From=parseone(scalar muttrc_get("from")); # may get undef()!; parseone() may be redundant
$muttrc_From=$muttrc_From->address() if $muttrc_From;
$opt_f=undef() if defined($opt_f) && $muttrc_From && lc($opt_f) eq lc($muttrc_From);
my $muttrc_From=parseone(scalar muttrc_get("from")); # may get undef()!; parseone() may be redundant
$muttrc_From=$muttrc_From->address() if $muttrc_From;
$opt_f=undef() if defined($opt_f) && $muttrc_From && lc($opt_f) eq lc($muttrc_From);
for (@h_from) {
$from_headername=$_; # leave last item in $from_headername
for (@h_from) {
$from_headername=$_; # leave last item in $from_headername
- last if @from_val=$head->get($from_headername);
- }
- @from_val=map({ ($_->address()); } map({ (Mail::Address->parse($_)); } @from_val));
- $from_headername=undef() if !(1==@from_val && $muttrc_From && lc($from_val[0]) eq lc($muttrc_From));
+ next if !(my @from_val=$head->get($from_headername));
+ @from_val=map({ ($_->address()); } map({ (Mail::Address->parse($_)); } @from_val));
+ $from_headername=undef() if !(1==@from_val && $muttrc_From && lc($from_val[0]) eq lc($muttrc_From));
+ last;
+ } # fallthru with $from_headername remaining set if last headername did not exist
# now $from_headername contains the header name to be replaced w/substituted value
}
# now $from_headername contains the header name to be replaced w/substituted value
}
# "From/Resent-From" should be handled by our &FromAddress
push @ARGV,"-F",$opt_F if defined $opt_F;
push @ARGV,$rcpt->address() if defined $rcpt;
# "From/Resent-From" should be handled by our &FromAddress
push @ARGV,"-F",$opt_F if defined $opt_F;
push @ARGV,$rcpt->address() if defined $rcpt;
+ push @ARGV,@addr_addon;
local $SIG{"PIPE"}=sub { die "Got SIGPIPE from ".sendmail_show(); };
local *SENDMAIL;
local $SIG{"PIPE"}=sub { die "Got SIGPIPE from ".sendmail_show(); };
local *SENDMAIL;
sendmail_orig_exec() if !$pid; # child
}
$head->print(\*SENDMAIL);
sendmail_orig_exec() if !$pid; # child
}
$head->print(\*SENDMAIL);
- print "\n"; # Mail::Header->print() eats the empty line but it doesn't print it
+ print SENDMAIL "\n"; # Mail::Header->print() eats the empty line but it doesn't print it
if (defined($stdin_body)) {
print SENDMAIL $stdin_body;
}
if (defined($stdin_body)) {
print SENDMAIL $stdin_body;
}