Skip to content

Commit 3bc985f

Browse files
Add exception
1 parent bb9505e commit 3bc985f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Mailer/Transport/SendGridTransport.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,9 @@ protected function _prepareEmailAddresses(Message $message)
193193
if (!empty($replyTo)) {
194194
if (key($replyTo) != $replyTo[key($replyTo)]) {
195195
$this->_reqParams['reply_to'] = (object)['email' => key($replyTo), 'name' => $replyTo[key($replyTo)]];
196-
197196
} else {
198197
$this->_reqParams['reply_to'] = (object)['email' => key($replyTo)];
199-
}
198+
}
200199
}
201200

202201
$emails = [];
@@ -207,6 +206,10 @@ protected function _prepareEmailAddresses(Message $message)
207206
];
208207
}
209208

209+
if (empty($emails['to'])) {
210+
throw new SendGridApiException('Missing to email address.');
211+
}
212+
210213
foreach ($message->getCc() as $ccEmail => $ccName) {
211214
$emails['cc'][] = [
212215
'email' => $ccEmail,

0 commit comments

Comments
 (0)