Skip to content

Provide the right flags to IDN methods for email addresses conversion #44092

@j-bernard

Description

@j-bernard

Symfony version(s) affected

5.3

Description

Symfony Mailer converts the email addresses domain to A-label in order to be compliant with servers that does not support the SMTPUTF8 flag but this conversion is not fully IDNA2008 compliant.

See #44091 that is the equivalent report for HttpClient.

This line should be fixed.

How to reproduce

$stream = new SocketStream();
$stream
    ->setHost($host)
    ->setPort($port)
    ->disableTls();
$transport = new SmtpTransport($stream);
$mailer = new Mailer($transport);
$email = (new Email())
    ->from($from)
    ->to($to)
    ->subject($subject)
    ->text($body);
$mailer->send($email);

If $to domain is fußball.test it should be converted to xn--fuball-cta.test instead of fussball.test.

Possible Solution

The following flags should be provided to be the most compliant possible with IDNA 2008:
IDNA_DEFAULT | IDNA_USE_STD3_RULES | IDNA_CHECK_BIDI | IDNA_CHECK_CONTEXTJ | IDNA_NONTRANSITIONAL_TO_ASCII

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions