One additional point to consider ... while
Email::Valid as pointed out by
kschwab and
azatoth is by far the better method by which to validate email addresses (compared to a single regex), this will not negate the possibility of bounced mail coming back to your mail server - This moduile performs a check to see if the email address appears to be valid, including RFC822 checks and DNS MX record checks, but does
not guarentee the validity of the email address with regards to delivery. It is still quite possible for someone to enter a 'bogus' email address that passes RFC and DNS checks, but cannot me delivered, whether due to mailer or remote configuration errors. eg. quota limits, unknown user, etc.
This is something to keep in mind where sending mail from web applications and can be curtailed through judicious use of
Email::Valid (with mxcheck enabled) and use of valid From: header fields in your application to direct bounced mail (on one of my boxes I have a mailbox directed to /dev/null specifically for such bounce messages).
Update: I should also point out that this aspect of mail delivery and handling of bounced mail is true of
ANY email validation system (short of the successful delivery and receipt of a test email message) -
Email::Valid however offers the most comprehensive and complete means (that I know of) of validating an email address prior to mail delivery.
Ooohhh, Rob no beer function well without!