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

Breadcrumb

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

function Envelope::anyAddressHasUnicodeLocalpart

Returns true if any address' localpart contains at least one non-ASCII character, and false if all addresses have all-ASCII localparts.

This helps 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/mailer/Envelope.php, line 104

Class

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

Namespace

Symfony\Component\Mailer

Code

public function anyAddressHasUnicodeLocalpart() : bool {
    if ($this->getSender()
        ->hasUnicodeLocalpart()) {
        return true;
    }
    foreach ($this->getRecipients() as $r) {
        if ($r->hasUnicodeLocalpart()) {
            return true;
        }
    }
    return false;
}
RSS feed
Powered by Drupal