Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Mail::CheckUser issue

by neilwatson (Curate)
on Aug 26, 2004 at 14:51 UTC ( #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

Comment on Mail::CheckUser issue
Select or Download Code
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
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? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (15)
As of 2014-10-21 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (103 votes), past polls