Skip to content

[Mailer] Update mailer.rst: Changing order of tips #20432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

ThomasLandauer
Copy link
Contributor

Page: https://symfony.com/doc/current/mailer.html#email-addresses

Reason: Bring the 2 IDN-related tips together.

@javiereguiluz
Copy link
Member

Good catch Thomas.

I wonder: shouldn't we remove this note?

.. note::

    The local part of the address (what goes before the ``@``) can include UTF-8
    characters, except for the sender address (to avoid issues with bounced emails).
    For example: ``föóbàr@example.com``, ``用户@example.com``, ``θσερ@example.com``, etc.

We say that ONLY the local part can contain UTF-8 chars ... but before we say that BOTH parts can contain UTF-8 chars.

@javiereguiluz javiereguiluz added this to the 7.2 milestone Dec 3, 2024
@carsonbot carsonbot changed the title Update mailer.rst: Changing order of tips [Mailer] Update mailer.rst: Changing order of tips Dec 3, 2024
@ThomasLandauer
Copy link
Contributor Author

I started a discussion about this at the PR (feel free to join!), in order to figure out what the best approach is: symfony/symfony#58361 (comment)

@ThomasLandauer
Copy link
Contributor Author

I figured out what the status-quo is:

Symfony works in 2 steps:

  1. If the domain contains utf8-characters, it's converted to punycode. This is supported by all SMTP servers.
  2. If the localpart contains utf8-characters, Symfony sends the SMTPUTF8 command. This is not supported by all SMTP servers.

So the message for the docs would be:

  1. Using an utf-domain is fine.
  2. If you're using an utf-localpart, you should:
    1. Find out if your SMTP server supports it (by opening a telnet session, then send EHLO, and look at the answer). If it doesn't support it, Symfony will throw an exception; i.e. it's better to filter those cases in advance.
    2. If you can, find out if the receiving SMTP server supports it (same telnet procedure). If it doesn't, then your SMTP server will send you a bounce DSN back.
      So depending on which server (yours or the remote) doesn't support it, you'll get the error message in a different way.

Besides, using an utf-localpart as sender address is always bad, since if any (unrelated) problem occurs with that, the currently-in-charge SMTP might not be able to send you a bounce (no SMTPUTF8 support).

I'm 99% sure that this is correct. So I'm suggesting: First, you need to decide on how much detail you want. Then somebody (you, me, whoever) needs to write it, then somebody needs to doublecheck it.
Cause if you don't want too much detail, there's no need to doublecheck everything...

BTW: You should fix https://symfony.com/blog/new-in-symfony-7-2-mime-improvements#comment-25595

@wouterj
Copy link
Member

wouterj commented Dec 7, 2024

Thank you Thomas!

@wouterj wouterj merged commit 979043e into symfony:7.2 Dec 7, 2024
3 checks passed
@ThomasLandauer ThomasLandauer deleted the patch-23 branch December 7, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants