I discovered I forgot the $smtp->mail() call in the above example, but it doesn't change the fact that I can't get the SkipBad option to work.
I tried all of the following combinations, uncommenting the recipient lines one at a time:
#!/usr/bin/perl
use Net::SMTP;
my $smtp = Net::SMTP->new('mail.bogusdomain.com');
die "Ugh." unless defined $smtp;
$smtp->mail($ENV{USER});
my @recipients = $smtp->recipient('totallybogus', SkipBad => 1);
#my @recipients = $smtp->recipient('totallybogus', Notify => 1, SkipBad => 1);
#my @recipients = $smtp->recipient('joe@flugwumpet.com', Notify => 1, SkipBad => 1);
#my @recipients = $smtp->recipient('joe@flugwumpet.com', SkipBad => 1);
#my @recipients = $smtp->recipient('bogususer@bogusdomain.com', Notify => 1, SkipBad => 1);
#my @recipients = $smtp->recipient('bogususer@bogusdomain.com', SkipBad => 1);
print "Recipients are '@recipients'\n";
$smtp->data();
$smtp->datasend('To: bogususer@bogusdomain.com, joe@flugwumpet.com' . qq{\n});
$smtp->datasend('Subject: A test.' . qq{\n});
$smtp->datasend("\n");
$smtp->datasend("This is a test.");
$smtp->dataend();
$smtp->quit();
and in every case, I got
What? ~/bin/test.pl Recipients are '1' What?The address bogususer@bogusdomain.com is a valid address (I changed the user and domain names in this post to protect the innocent), joe@flugwumpet.com is an invalid address, and totallybogus is an *obviously* bad address.
I even received both e-mails to the correct recipient and failure notices to the bogus addresses from the mailer daemon.
I am seriously considering the possiblity that the SkipBad option simply does not work as advertised. That would seem odd given that Net::SMTP is probably one of the most heavily used modules on the CPAN.
Harumph!
In reply to Re: Re: Simple Net::SMTP question
by Starky
in thread Simple Net::SMTP question
by Starky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |