Skip to content

Commit 799b63b

Browse files
committed
minor #20581 [Mailer] [Smtp] Add source_ip option (quilius)
This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [Mailer] [Smtp] Add source_ip option This PR documents the `source_ip` feature in this PR: https://github.com/symfony/symfony/pull/59482/files Commits ------- 5788861 [Mailer] [Smtp] Add source_ip option
2 parents e53787c + 5788861 commit 799b63b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

mailer.rst

+21
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,27 @@ setting the ``auto_tls`` option to ``false`` in the DSN::
426426

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

429+
Binding to IPv4 or IPv6
430+
~~~~~~~~~~~~~~~~~~~~~~~
431+
432+
.. versionadded:: 7.3
433+
434+
The option to bind to IPv4 or IPv6 or a specific IP address was introduced in Symfony 7.3.
435+
436+
By default, the underlying SocketStream will bind to IPv4 or IPv6 depending on the available
437+
interfaces. By specifying the ``source_ip`` option, binding to either IPv4 or IPv6 can be enforced,
438+
or even to a specific address. To bind to IPv4, use::
439+
440+
$dsn = 'smtp://smtp.example.com?source_ip=0.0.0.0';
441+
442+
As per RFC2732, IPv6 addresses must be surrounded by square brackets. To bind to IPv6, use::
443+
444+
$dsn = 'smtp://smtp.example.com?source_ip=[::]';
445+
446+
.. note::
447+
448+
This setting only works when the ``smtp://`` protocol is used.
449+
429450
Overriding default SMTP authenticators
430451
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
431452

0 commit comments

Comments
 (0)