SYNOPSIS

    use Mail::Verify;

DESCRIPTION

\*(C`Mail::Verify\*(C' provides a function CheckAddress function for verifying email addresses. First the syntax of the email address is checked, then it verifies that there is at least one valid \s-1MX\s0 server accepting email for the domain. Using Net::DNS and IO::Socket a list of \s-1MX\s0 records (or, falling back on a hosts A record) are checked to make sure at least one \s-1SMTP\s0 server is accepting connections.

ERRORS

Here are a list of return codes and what they mean:

  • The email address appears to be valid.

  • No email address was supplied.

  • There is a syntaxical error in the email address.

  • There are no \s-1DNS\s0 entries for the host in question (no \s-1MX\s0 records or A records).

  • There are no live \s-1SMTP\s0 servers accepting connections for this email address.

EXAMPLES

This example shows obtaining an email address from a form field and verifying it.

use CGI qw/:standard/; use Mail::Verify; my $q = new CGI; [...] my $email = $q->param("emailaddr"); my $email_ck = Mail::Verify::CheckAddress( $email ); if( $email_ck ) { print '<h1>Form input error: Invalid email address.</h1>'; } [...]