diff --git a/src/PHPMailer.php b/src/PHPMailer.php index 25ac1791..d9a3b94d 100644 --- a/src/PHPMailer.php +++ b/src/PHPMailer.php @@ -2189,6 +2189,8 @@ class PHPMailer * The default language is English. * * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") + * Optionally, the language code can be enhanced with a 4-character + * script annotation and/or a 2-character country annotation. * @param string $lang_path Path to the language file directory, with trailing separator (slash).D * Do not set this from user input! * @@ -2251,7 +2253,10 @@ class PHPMailer //Validate $langcode $foundlang = true; $langcode = strtolower($langcode); - if (!preg_match('/^(?P[a-z]{2})(?P_[a-z]{2})?$/', $langcode, $matches) && $langcode !== 'en') { + if ( + !preg_match('/^(?P[a-z]{2})(?P