From e1048bb02c847ecb32db81e5617e46643af6ffbf Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 1 Mar 2025 12:16:24 +0000 Subject: [PATCH 1/3] [Mailer] Document require_tls option For #20644 --- mailer.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/mailer.rst b/mailer.rst index fd34a921b14..5ecf26e92b6 100644 --- a/mailer.rst +++ b/mailer.rst @@ -416,6 +416,29 @@ setting the ``auto_tls`` option to ``false`` in the DSN:: the Internet, but it can be useful when both the application and the SMTP server are in a secured network, where there is no need for additional encryption. +.. note:: + + This setting only works when the ``smtp://`` protocol is used. + +Require use of TLS +~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 7.3 + + The option to require TLS was introduced in Symfony 7.3. + +You may want to ensure TLS is used, either directly or via ``STARTTLS``, +for sending mail over SMTP regardless of other options set or SMTP server +support. You can set TLS as required by calling ``setRequireTls(true)`` +on the ``EsmtpTransport`` instance, or by setting the ``require_tls`` option +to ``true`` in the DSN:: + + $dsn = 'smtp://user:pass@10.0.0.25?require_tls=true'; + +When TLS is set as required, a :class:`Symfony\\Component\\Mailer\\Exception\\TransportException` +will be thrown if a TLS connection cannot be achieved during initial communications +with the SMTP server. + .. note:: This setting only works when the ``smtp://`` protocol is used. From 7a2eb90117d1b9689115f9f07ee113b2bcc227bd Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 19 Mar 2025 12:36:54 +0000 Subject: [PATCH 2/3] [Mailer] Moved version notice to after note for require_tls As requested by OskarStark. --- mailer.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mailer.rst b/mailer.rst index 5ecf26e92b6..fd95f1668ee 100644 --- a/mailer.rst +++ b/mailer.rst @@ -423,10 +423,6 @@ setting the ``auto_tls`` option to ``false`` in the DSN:: Require use of TLS ~~~~~~~~~~~~~~~~~~ -.. versionadded:: 7.3 - - The option to require TLS was introduced in Symfony 7.3. - You may want to ensure TLS is used, either directly or via ``STARTTLS``, for sending mail over SMTP regardless of other options set or SMTP server support. You can set TLS as required by calling ``setRequireTls(true)`` @@ -443,6 +439,10 @@ with the SMTP server. This setting only works when the ``smtp://`` protocol is used. +.. versionadded:: 7.3 + + The option to require TLS was introduced in Symfony 7.3. + Binding to IPv4 or IPv6 ~~~~~~~~~~~~~~~~~~~~~~~ From 4871fd0fd3fd28e65e3d3db8edbbd41b80aabb8b Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 24 Mar 2025 09:10:04 +0000 Subject: [PATCH 3/3] [Mailer] Tweaked version notice for require_tls option Co-authored-by: Maxime Doutreluingne --- mailer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index fd95f1668ee..8d6295bbb93 100644 --- a/mailer.rst +++ b/mailer.rst @@ -441,7 +441,7 @@ with the SMTP server. .. versionadded:: 7.3 - The option to require TLS was introduced in Symfony 7.3. + The ``require_tls`` option was introduced in Symfony 7.3. Binding to IPv4 or IPv6 ~~~~~~~~~~~~~~~~~~~~~~~