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

Mail::CheckUser issue

by neilwatson (Priest)
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;


$validemail mails good Cannot connect SMTP servers: good Cannot connect SMTP servers: validemail is finished

Neil Watson

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?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2020-10-24 00:38 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (242 votes). Check out past polls.