From dc3de33a4b03cbbb17acb565ba6826ac42f2d189 Mon Sep 17 00:00:00 2001 From: msquare Date: Sun, 3 Nov 2019 11:43:13 +0100 Subject: [PATCH] fix #287: handle IDN email addresses --- includes/sys_page.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/sys_page.php b/includes/sys_page.php index e94a92cc..c7b3ec74 100644 --- a/includes/sys_page.php +++ b/includes/sys_page.php @@ -220,12 +220,18 @@ function strip_item($item) } /** - * Überprüft eine E-Mail-Adresse. + * Validates an email address with support for IDN domain names. * * @param string $email * @return bool */ function check_email($email) { + // Convert the domain part from idn to ascii + if(substr_count($email, '@') == 1) { + list($name, $domain) = explode('@', $email); + $domain = idn_to_ascii($domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); + $email = $name . '@' . $domain; + } return (bool)filter_var($email, FILTER_VALIDATE_EMAIL); }