Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 07bfe6b

Browse files
bug #34954 [Mailer] Fixed undefined index when sending via Mandrill API (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
2 parents cb96f14 + ef0aa4d commit 07bfe6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
5757
throw new HttpTransportException(sprintf('Unable to send an email (code %s).', $result['code']), $response);
5858
}
5959

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

6263
return $response;
6364
}

0 commit comments

Comments
 (0)