Skip to content

Commit 7d360e6

Browse files
committed
minor #20701 [Mailer] Document require_tls option (ssddanbrown)
This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [Mailer] Document `require_tls` option For #20644. This PR documents the added SMTP `require_tls` option, as introduced in symfony/symfony#59479. I have referenced that this could throw a `TransportException` (where TLS is not achieved) but not sure if I should instead reference `TransportExceptionInterface`. Commits ------- 55217dc [Mailer] Document `require_tls` option
2 parents 80f843a + 55217dc commit 7d360e6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mailer.rst

+23
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,29 @@ setting the ``auto_tls`` option to ``false`` in the DSN::
420420

421421
This setting only works when the ``smtp://`` protocol is used.
422422

423+
Ensure TLS
424+
~~~~~~~~~~
425+
426+
You may want to ensure TLS is used, either directly or via ``STARTTLS``,
427+
for sending mail over SMTP regardless of other options set or SMTP server
428+
support. You can set TLS as required by calling ``setRequireTls(true)``
429+
on the ``EsmtpTransport`` instance, or by setting the ``require_tls`` option
430+
to ``true`` in the DSN::
431+
432+
$dsn = 'smtp://user:[email protected]?require_tls=true';
433+
434+
When TLS is set as required, a :class:`Symfony\\Component\\Mailer\\Exception\\TransportException`
435+
will be thrown if a TLS connection cannot be achieved during initial communications
436+
with the SMTP server.
437+
438+
.. note::
439+
440+
This setting only works when the ``smtp://`` protocol is used.
441+
442+
.. versionadded:: 7.3
443+
444+
The ``require_tls`` option was introduced in Symfony 7.3.
445+
423446
Binding to IPv4 or IPv6
424447
~~~~~~~~~~~~~~~~~~~~~~~
425448

0 commit comments

Comments
 (0)