Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (24 sloc) 1.06 KB

Email Addressing, Processing, and Handling

How do I see if an email address is valid?

In general, you can't. There are several methods available to see if it looks reasonable, but there is no way to determine if an address is actually deliverable without actually attempting delivery.

Using regular expressions:

# Match basically blah@blah.blah
if ( $addr =~ /^\S+\@\S+\.\S+$/ ) {
    print "Looks OK";

If you're doing any real work, you may wish to look to one of the modules available on, such as:


Email::Valid makes it easy to determine if an email address is well-formed:

use Email::Valid;

print ( Email::Valid->address( '' ) ? 'Yes' : 'No' ); # prints Yes
print ( Email::Valid->address( '' ) ? 'Yes' : 'No' ); # prints No

Email::Valid can also tell you why an address is invalid:

print "Invalid address: $Email::Valid::Details \n"
    unless Email::Valid->address( '' );