Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regular expression to validate email address for IDN #3620

Closed
opencart-russia opened this issue Nov 11, 2015 · 4 comments
Closed

regular expression to validate email address for IDN #3620

opencart-russia opened this issue Nov 11, 2015 · 4 comments

Comments

@opencart-russia
Copy link
Contributor

Hi Daniel. May be create helper for validate email? Or add to settings tabs mail, field "regular expression to validate email" ??

Now expression not correct validate emails for Internationalized Domain Names!

preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i'

Example. иван@почта.рф (for Russia) and امارات@امارات.اما.امارات (for Egipt) etc ...

This email fine work in gmail, but not work in opencart.

What do you think about this?

@danielkerr
Copy link
Member

If u can come up with a soultion then please post a better regx

@opencart-russia
Copy link
Contributor Author

Universal regx solution is a very big.

In addition to the variants that I suggested, you can try to use punycode converter for correct validate https://github.com/true/php-punycode

And see look at how others have solved https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/string/punycode.php#L195

@danielkerr
Copy link
Member

check latest commit

@ADDCreative
Copy link
Contributor

I don't think filter_var with FILTER_VALIDATE_EMAIL supports IDNs. See https://bugs.php.net/bug.php?id=39469. Wouldn't an email with an IDN would still need converting first?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants