diff -urN ../postfixadmin-3.3.10.orig/functions.inc.php ./functions.inc.php --- ../postfixadmin-3.3.10.orig/functions.inc.php 2021-08-17 17:08:20.000000000 +0300 +++ ./functions.inc.php 2022-02-10 13:47:43.014659000 +0200 @@ -231,12 +231,18 @@ * @todo skip DNS check if the domain exists in PostfixAdmin? */ 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')) { @@ -310,7 +316,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);