Skip to content

Commit

Permalink
bug #34954 [Mailer] Fixed undefined index when sending via Mandrill A…
Browse files Browse the repository at this point in the history
…PI (wulff)

This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Fixed undefined index when sending via Mandrill API

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34892
| License       | MIT

When a [Mandrill API send request](https://www.mandrillapp.com/api/docs/messages.JSON.html#method=send) is succesful, it returns an array of results, one for each recipient. To get rid of the undefined index error, we grab the message ID from the first recipient in the array.

Commits
-------

ef0aa4d [Mailer] fixed undefined index when sending mail
  • Loading branch information
nicolas-grekas committed Dec 17, 2019
2 parents cb96f14 + ef0aa4d commit 07bfe6b
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -57,7 +57,8 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
throw new HttpTransportException(sprintf('Unable to send an email (code %s).', $result['code']), $response);
}

$sentMessage->setMessageId($result['_id']);
$firstRecipient = reset($result);
$sentMessage->setMessageId($firstRecipient['_id']);

return $response;
}
Expand Down

0 comments on commit 07bfe6b

Please sign in to comment.