Fixed (suppressed) bell if $store_ignore
[PerlMail.git] / perlmail-sendmail
index 5f6a070..3cf3f3f 100755 (executable)
@@ -17,7 +17,8 @@ require Mail::Alias;
 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") ? ($_) : ());
+# Mail-Alias-1.12 will clutter $_ !
+my @addr_addon=(Mail::Alias->new("/etc/aliases")->exists("sentout") ? ("sentout") : ());
 my $opt_F;
 sub FromAddress
 {
@@ -230,7 +231,11 @@ my $from_headername;
        }
 
 my $exitcode=0;
-my @rcpts=(@addr ? @addr : (undef())); # !defined($rcpt) if we have no recipients
+# !defined($rcpt) if we have no recipients
+# make the list unique to prevent dupes being normally filtered by sendmail(8)
+# one '{' is block-wrapper, another '{' is hash-indirection!
+my @rcpts=keys(%{{ map(($_=>1),(@addr ? @addr : (undef()))) }});
+
 my $stdin_body=(@rcpts<=1 ? undef() : do {     # store input data only if it will be used multiple times
                local $/=undef();
                <STDIN>;