diff -urN ../postfixadmin-cd73f275.orig/functions.inc.php ./functions.inc.php --- ../postfixadmin-cd73f275.orig/functions.inc.php 2021-09-02 23:45:38.000000000 +0300 +++ ./functions.inc.php 2022-02-03 21:50:17.273507000 +0200 @@ -242,12 +242,16 @@ */ function check_domain($domain) { - if (!preg_match('/^([-0-9A-Z]+\.)+' . '([-0-9A-Z]){1,13}$/i', ($domain))) { + if (!preg_match('/^(([-0-9A-Z]+\.)+' . '([-0-9A-Z]){1,13}|localhost)$/i', ($domain))) { return sprintf(Config::lang('pInvalidDomainRegex'), htmlentities($domain)); } if (Config::bool('emailcheck_resolve_domain') && 'WINDOWS'!=(strtoupper(substr(php_uname('s'), 0, 7)))) { + if ($domain == 'localhost') { + return ''; + } + // Look for an AAAA, A, or MX record for the domain if (function_exists('checkdnsrr')) { @@ -323,7 +327,7 @@ return "" . Config::lang_f('pInvalidMailRegex', $email); } - if (function_exists('filter_var')) { + if ((function_exists('filter_var')) and (!preg_match('/^\S+@localhost$/', $email))) { $check = filter_var($email, FILTER_VALIDATE_EMAIL); if (!$check) { return "" . Config::lang_f('pInvalidMailRegex', $email);