Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Address.php

function Address::hasUnicodeLocalpart

Returns true if this address' localpart contains at least one non-ASCII character, and false if it is only ASCII (or empty).

This is a helper for Envelope, which has to decide whether to the SMTPUTF8 extensions (RFC 6530 and following) for any given message.

The SMTPUTF8 extension is strictly required if any address contains a non-ASCII character in its localpart. If non-ASCII is only used in domains (e.g. horst@freiherr-von-mühlhausen.de) then it is possible to send the message using IDN encoding instead of SMTPUTF8. The most common software will display the message as intended.

File

vendor/symfony/mime/Address.php, line 136

Class

Address
@author Fabien Potencier <fabien@symfony.com>

Namespace

Symfony\Component\Mime

Code

public function hasUnicodeLocalpart() : bool {
    return (bool) preg_match('/[\\x80-\\xFF].*@/', $this->address);
}
RSS feed
Powered by Drupal