Free stripsexcams - Validating an email address in php


If you want to know which regex pattern PHP (currently) uses to validate email addresses see the PHP source.

If you want to learn more about email addresses I suggest you to start reading the specs, but I have to warn you it is not an easy read by any stretch: P. A note on the regex pattern used above (from the PHP source).

validating an email address in php-39validating an email address in php-29validating an email address in php-60

Email addresses: easy to create, difficult to type. Note that FILTER_VALIDATE_EMAIL will validate email addresses that contain domains and top-level domains that do not exist.

Fortunately, PHP (5 and later) comes with a handy set of functions and filters that make testing for email address validity a snap.

It's rare for me to ever describe one approach as the "right" way to do something - but for validating data, Filter really is excellent, offering both validating and sanitising filters and generally making it super-easy to clean up incoming variables.

Many of the frameworks offer equivalents, and I'm sure many of those are wrapping this too.

Email verification can be done using Windows Telnet as well.