composer require miovisman/normemail
$nEmail = new MioVisman\NormEmail\NormEmail();
$email = $nEmail->normalize($email);
- Use a normalized email to check the ban or uniqueness of the email of a new user. Check on the normalized emails ;)
- The domain is lowercase (and in Punycode)
- The local part is lowercase unless otherwise specified
- The local part after the "+" is truncated (for Yahoo domains - after the "-")
// some string
=>
ExampLe => example
ExampLe@ => example@
exaMple.COM => example.com
.example.com => .example.com
@examPLe.com => example.com
"examPLe.com => "example.com
"[email protected] => "[email protected]
googlemail.com => gmail.com
pm.me => protonmail.com
yandex.tj => yandex.ru
ya.ru => yandex.ru
.ya.ru => .yandex.ru
// Unicode
ПОЛЬЗОВАТЕЛЬ@домен.РУ => пользователь@xn--d1acufc.xn--p1ag
пользователь+тег@домен.ру => пользователь@xn--d1acufc.xn--p1ag
// Gmail
[email protected] => [email protected]
[email protected] => [email protected]
// Protonmail
[email protected] => [email protected]
[email protected] => [email protected]
// Yahoo (.com, .ae, .at, ...)
[email protected] => [email protected]
[email protected] => [email protected]
// Yandex (13 domains)
user.name+tag@яндекс.рф => [email protected]
[email protected] => [email protected]
[email protected] => [email protected]
This project is under MIT license. Please see the license file for details.