Skip to content

Commit 6141683

Browse files
committed
Merge branch '4.4'
* 4.4: Add docs on Address::fromString
2 parents 989ac58 + 3bc96a4 commit 6141683

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mailer.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,21 @@ both strings or address objects::
135135
// email address as an object
136136
->from(new Address('fabien@example.com'))
137137

138-
// email address as an object (email clients will display the name
139-
// instead of the email address)
138+
// defining the email address and name as an object
139+
// (email clients will display the name)
140140
->from(new Address('fabien@example.com', 'Fabien'))
141141

142+
// defining the email address and name as a string
143+
// (the format must match: 'Name <email@example.com>')
144+
->from(Address::fromString('Fabien Potencier <fabien@example.com>'))
145+
142146
// ...
143147
;
144148

149+
.. versionadded:: 4.4
150+
151+
The ``Address::fromString()`` method was introduced in Symfony 4.4.
152+
145153
Multiple addresses are defined with the ``addXXX()`` methods::
146154

147155
$email = (new Email())

0 commit comments

Comments
 (0)