Skip to content

Commit e1048bb

Browse files
committed
[Mailer] Document require_tls option
For symfony#20644
1 parent 8404c9b commit e1048bb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mailer.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,29 @@ setting the ``auto_tls`` option to ``false`` in the DSN::
416416
the Internet, but it can be useful when both the application and the SMTP
417417
server are in a secured network, where there is no need for additional encryption.
418418

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

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

0 commit comments

Comments
 (0)