ASPN ActiveState Programmer Network  
ActiveState, a division of Sophos
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups
Submit Recipe
My Recipes

All Recipes
All Cookbooks


View by Category

Title: Validating email addresses with Mail::CheckUser
Submitter: Ken Simpson (other recipes)
Last Updated: 2001/06/20
Version no: 1.0
Category: Networking

 

4 stars 2 vote(s)


Approved

Description:

The only way to really know whether an email address is valid is to try
sending mail to it. i.e., no simple regular expression exists which can
verify the correctness of any given email address. The Mail::CheckUser
module (available on CPAN) verifies that a particular email address is valid
by first checking the syntax of the email address, then checking whether an
email server exists for that address, and finally contacting that email
server to verify that the given address exists.

Usage: Text Source

use Mail::CheckUser qw(check_email);
my $ok = check_email($email);

if($ok) {
  # The address is valid... Do stuff with it.
}

The license for this recipe is available here.

Discussion:

Mail::CheckUser was suggested by Walter Hafner in article 30293638 of comp.lang.perl.misc.



Add comment

No comments.



Highest rated recipes:

1. Breaking down a URI into ...

2. Extracting HTML URL Links

3. Removing dangerous ...

4. Matching Royal Mail ...

5. Finding Palindromes

6. Finding URLs in text -- ...

7. Extract the Korean ...

8. Validate Domain Names

9. Validating email ...

10. Remove any HTML




Privacy Policy | Email Opt-out | Feedback | Syndication
© 2006 ActiveState Software Inc. All rights reserved.