Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a PHP library for email address validation? [closed]

I need to validate the email address of my users. Unfortunately, making a validator that conforms to standards is hard.

Here is an example of a regex expression that tries to conform to the standard.

Is there a PHP library (preferably, open-source) that validates an email address?

like image 369
MrValdez Avatar asked Oct 02 '08 08:10

MrValdez


People also ask

How can I validate an existing email address in PHP?

The validateEmail() function above uses the filter_var() PHP function to validate an email address. If you pass the FILTER_VALIDATE_EMAIL option filter to it, filter_var() will validate the email address stored in $email from a syntactical point of view and return the filtered data on success, or false on failure.

Which validator used for email address?

Most email service providers (ESPs) provide email validation services. There are many free tools that also validate email addresses; ValidateEmailAddress, EmailValidator and Pabbly Email Verification are few of such examples.

What is real time email validation?

Real time email verification lets you verify email addresses as they are typed in the signup form. Our REST API instantly checks if the address is valid and helps customers correct email typos. It also prevents disposable, invalid or shared addresses from getting into your list and lowering your mailing list quality.

How validate email in PHP explain with example?

Example. <? php $email = "[email protected]"; // Validate email if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo("$email is a valid email address"); } else{ echo("$email is not a valid email address"); } ?>


1 Answers

Have you looked at PHP's filter_ functions? They're not perfect, but they do a fairly decent job in my experience.

Example usage (returns boolean):

filter_var($someEmail, FILTER_VALIDATE_EMAIL);

like image 193
Chris Avatar answered Oct 12 '22 23:10

Chris