File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -140,13 +140,21 @@ both strings or address objects::
140140 // email address as an object
141141 ->from(new Address('fabien@example.com'))
142142
143- // email address as an object (email clients will display the name
144- // instead of the email address )
143+ // defining the email address and name as an object
144+ // (email clients will display the name )
145145 ->from(new Address('fabien@example.com', 'Fabien'))
146146
147+ // defining the email address and name as a string
148+ // (the format must match: 'Name <email@example.com>')
149+ ->from(Address::fromString('Fabien Potencier <fabien@example.com>'))
150+
147151 // ...
148152 ;
149153
154+ .. versionadded :: 4.4
155+
156+ The ``Address::fromString() `` method was introduced in Symfony 4.4.
157+
150158Multiple addresses are defined with the ``addXXX() `` methods::
151159
152160 $email = (new Email())
@@ -157,15 +165,6 @@ Multiple addresses are defined with the ``addXXX()`` methods::
157165 // ...
158166 ;
159167
160- An ``Address `` can be created from a single string::
161-
162- $email = (new Email())
163- ->from(Address::fromString('Fabien <fabien@example.com>'))
164-
165- // ...
166- ;
167-
168-
169168Alternatively, you can pass multiple addresses to each method::
170169
171170 $toAddresses = ['foo@example.com', new Address('bar@example.com')];
You can’t perform that action at this time.
0 commit comments