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::
140
140
// email address as an object
141
141
->from(new Address('fabien@example.com'))
142
142
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 )
145
145
->from(new Address('fabien@example.com', 'Fabien'))
146
146
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
+
147
151
// ...
148
152
;
149
153
154
+ .. versionadded :: 4.4
155
+
156
+ The ``Address::fromString() `` method was introduced in Symfony 4.4.
157
+
150
158
Multiple addresses are defined with the ``addXXX() `` methods::
151
159
152
160
$email = (new Email())
@@ -157,15 +165,6 @@ Multiple addresses are defined with the ``addXXX()`` methods::
157
165
// ...
158
166
;
159
167
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
-
169
168
Alternatively, you can pass multiple addresses to each method::
170
169
171
170
$toAddresses = ['foo@example.com', new Address('bar@example.com')];
You can’t perform that action at this time.
0 commit comments