This is an excerpt from the latest version perlfaq9.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at
http://faq.perl.org .
--------------------------------------------------------------------
9.17: How do I check a valid mail address?
(partly contributed by Aaron Sherman)
This isn't as simple a question as it sounds. There are two parts:
a) How do I verify that an email address is correctly formatted?
b) How do I verify that an email address targets a valid recipient?
Without sending mail to the address and seeing whether there's a human
on the other end to answer you, you cannot fully answer part *b*, but
either the "Email::Valid" or the "RFC::RFC822::Address" module will do
both part *a* and part *b* as far as you can in real-time.