Possible Duplicate:
How to validate an Email in PHP?
Does PHP have a built in function for determining if an email address is formatted properly. I know it can't go out and check if the email is actually active; I'm talking about just confirming that an email address is structurally correct.
PHP - Validate E-mail The easiest and safest way to check whether an email address is well-formed is to use PHP's filter_var() function.
How can I check if an email address is valid for free? Use an email validation service. Many services provide a web tool on their website where you can quickly verify the address in real time. The service does all the work of checking the syntax and reviewing the MX records.
filter_var
can do this:
$result = filter_var( '[email protected]', FILTER_VALIDATE_EMAIL );
It returns false
when it failed validation, and returns the e-mail address otherwise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With