WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана


PHPMailer::punyencodeAddress() public WP 1.0

Converts IDN in given email address to its ASCII form, also known as punycode, if possible. Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet. This function silently returns unmodified address if:

  • No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form)
  • Conversion to punycode is impossible (e.g. required PHP functions are not available) or fails for any reason (e.g. domain contains characters not allowed in an IDN).

{} Это метод класса: PHPMailer{}

Хуков нет.


Строку. The encoded address in ASCII form


$PHPMailer = new PHPMailer();
$PHPMailer->punyencodeAddress( $address );
$address(строка) (обязательный)
The email address to convert


  • Смотрите: PHPMailer::$CharSet

Код PHPMailer::punyencodeAddress() WP 5.5.1

public function punyencodeAddress($address)
    // Verify we have required functions, CharSet, and at-sign.
    $pos = strrpos($address, '@');
    if (!empty($this->CharSet) &&
        false !== $pos &&
    ) {
        $domain = substr($address, ++$pos);
        // Verify CharSet string is a valid one, and domain properly encoded in this CharSet.
        if ($this->has8bitChars($domain) && @mb_check_encoding($domain, $this->CharSet)) {
            $domain = mb_convert_encoding($domain, 'UTF-8', $this->CharSet);
            //Ignore IDE complaints about this line - method signature changed in PHP 5.4
            $errorcode = 0;
            if (defined('INTL_IDNA_VARIANT_UTS46')) {
                // phpcs:ignore PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet
                $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_UTS46);
            } elseif (defined('INTL_IDNA_VARIANT_2003')) {
                // phpcs:ignore PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003Deprecated
                $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_2003);
            } else {
                // phpcs:ignore PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet
                $punycode = idn_to_ascii($domain, $errorcode);
            if (false !== $punycode) {
                return substr($address, 0, $pos) . $punycode;

    return $address;