exaprint / mail-helper
email validator
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
Installs: 1 691
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 11
Forks: 0
Open Issues: 0
pkg:composer/exaprint/mail-helper
Requires
- php: ^5.6 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^5.7 || ^6.2
This package is not auto-updated.
Last update: 2022-09-30 09:34:20 UTC
README
https://msdn.microsoft.com/en-us/library/01escwtf(v=vs.110).aspx
Examples:
| return value | result | |
|---|---|---|
[email protected] |
null |
Valid |
[email protected] |
null |
Valid |
[email protected] |
null |
Valid |
[email protected] |
'wrongEmailFormat' |
Invalid |
[email protected] |
null |
Valid |
js#[email protected] |
null |
Valid |
j_9@[129.126.118.1 |
null |
Valid |
[email protected] |
'wrongEmailFormat' |
Invalid |
js*@proseware.com |
'wrongEmailFormat' |
Invalid |
[email protected] |
'wrongEmailFormat' |
Invalid |
[email protected] |
null |
Valid |
[email protected] |
null |
Valid |
"j\"s\""@proseware.com |
null |
Valid |
"j\"s\"\"@proseware.com |
'wrongEmailFormat' |
Invalid |
Usage:
if (null !== Exaprint\MailHelper\Validate::validateEmailFormat($email)) { throw new Exception('invalid_email'); }
echo '<scripts> var regexValidateMail = ' . Exaprint\MailHelper\Validate::getRegex() . ' </scripts>';
try { $validate = Exaprint\MailHelper\Validate::getValidate(Exaprint\MailHelper\Validate::THROW_EXCEPTIONS); $validate->validate($email1); $validate->validate($email2); $validate->validate($email3, Exaprint\MailHelper\Validate::DO_NOT_THROW_EXCEPTIONS); } catch (Exaprint\MailHelper\ValidateException $e) { // Do something. }
$validate = Exaprint\MailHelper\Validate::getValidate(Exaprint\MailHelper\Validate::DO_NOT_THROW_EXCEPTIONS, $email); if (!$validate->validate()) { throw new \Exception('invalidEmail'); }
Unit test & coverage:
Use dev-dependencies
vendor/phpunit/phpunit/phpunit