File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
src/Symfony/Component/Mime Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ public function generateMessageId(): string
141
141
$ sender = $ this ->headers ->get ('Sender ' )->getAddress ();
142
142
} elseif ($ this ->headers ->has ('From ' )) {
143
143
if (empty ($ froms = $ this ->headers ->get ('From ' )->getAddresses ())) {
144
- throw new LogicException ('Your email has a From header but no addresses. Did you forgot to add emails in the "from" method ? ' );
144
+ throw new LogicException ('Your email has a From header that contains no addresses. Did you forgot to add emails in the "from" method ? ' );
145
145
}
146
146
$ sender = $ froms [0 ];
147
147
} else {
Original file line number Diff line number Diff line change @@ -125,6 +125,14 @@ public function testGetPreparedHeadersHasSenderWhenNeeded()
125
125
$ this ->assertEquals ('thomas@symfony.com ' , $ message ->getPreparedHeaders ()->get ('Sender ' )->getAddress ()->getAddress ());
126
126
}
127
127
128
+ public function testGenerateMessageIdThrowsWhenHasSenderButNoAddresses ()
129
+ {
130
+ $ this ->expectException (\LogicException::class);
131
+ $ message = new Message ();
132
+ $ message ->getHeaders ()->addMailboxListHeader ('From ' , []);
133
+ $ message ->generateMessageId ();
134
+ }
135
+
128
136
public function testToString ()
129
137
{
130
138
$ message = new Message ();
You can’t perform that action at this time.
0 commit comments