[Mailer] fixed undefined index when sending mail

When a Mandrill API request 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.
This commit is contained in:
Morten Wulff 2019-12-12 15:05:36 +01:00
parent a656a57736
commit ef0aa4dc87

View File

@ -57,7 +57,8 @@ class MandrillApiTransport extends AbstractApiTransport
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;
}