Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Mail::CheckUser issue

by neilwatson (Priest)
on Aug 26, 2004 at 14:51 UTC ( [id://386038]=perlquestion: print w/replies, xml ) Need Help??

neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

Using Mail::CheckUser I would expect it to make an address as bad if an SMTP lookup fails. This is not happening:

Code snippet:

#timeout on DNS and SMTP network checks $Mail::CheckUser::Timeout = 10; $Mail::CheckUser::Treat_Timeout_As_Fail = 1; foreach $add (@adds){ $pm->start and next; if (Mail::CheckUser::check_email($add)){ writeaddr(*GOODADDR, $add); #address is good print $add." good ".Mail::CheckUser::last_check()->{reason}."\ +n"; $pm->finish; }else{ writeaddr(*BADADDR, $add); #address is bad print $add." bad".Mail::CheckUser::last_check()->{reason}."\n" +; $pm->finish; } } $pm->wait_all_children;

Output:

$validemail mails janedoe@epatra.com good Cannot connect SMTP servers: 65.182.162.90 joeblow@attcanada.com good Cannot connect SMTP servers: 216.21.229.196 validemail is finished

Neil Watson
watson-wilson.ca

Replies are listed 'Best First'.
Re: Mail::CheckUser issue
by keszler (Priest) on Aug 26, 2004 at 15:51 UTC
    Your expectations do not match those of the module's author:
    return _result(CU_SMTP_UNREACHABLE, 'Cannot connect SMTP servers: ' . join(', ', @mservers)); ... sub _result($$) { my($code, $reason) = @_; my $ok = 0; $ok = 1 if $code == CU_OK; $ok = 1 if $code == CU_SMTP_UNREACHABLE; ...

    The module's author apparantly decided not to assume a bad address if the server cannot be reached. You'll need to add your own test, i.e.

    if (Mail::CheckUser::last_check()->{code} == CU_SMTP_UNREACHABLE) { # can't reach server ... }
      The module's author apparantly decided not to assume a bad address if the server cannot be reached.

      And, if you want to prevent legal addresses being rejected, it's a good assumption too. An unreachable SMTP server doesn't necessarily mean that the e-mail address is invalid.

        I agree, completely. The only value I see in discarding an email address due to CU_SMTP_UNREACHABLE is when checking from the same IP address from which the email will be sent (e.g. routing and/or blocking issues) for email that is worthless if delayed. (Some kind of alert email, perhaps?).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://386038]
Approved by Joost
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-18 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found