Add support for non-ASCII domain names in FV & Email classes' valid_email()
Depends on the Intl extension
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index c39a26a..88398d3 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1079,6 +1079,11 @@
*/
public function valid_email($email)
{
+ if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@'))
+ {
+ $email = substr($email, 0, ++$atpos).idn_to_ascii(substr($email, $atpos));
+ }
+
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}