in reply to Re: Simple Net::SMTP question
in thread Simple Net::SMTP question

Thanks for your prompt reply :-)

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!

Replies are listed 'Best First'.
Re: Re: Re: Simple Net::SMTP question
by shotgunefx (Parson) on Aug 24, 2001 at 02:28 UTC
    dga is right , BUT
    When I pass the options as a hash, I get

    Can't use string ("1") as an ARRAY ref while "strict refs" in use at /usr/local/lib/perl5/site_perl/5.6.1/Net/SMTP.pm line 278.

    The code it is choking on is in the recipient sub.

    if(defined ($v = delete $opt{Notify}) )

    Why is this treating $opt{Notify} as an array reference? It's not. (It's set to 1)

    I'm using version 2.16.
    I am very perplexed at how it's coming up with this context.

    -Lee

    "To be civilized is to deny one's nature."