Reputation: 180
This might be a simple question but I've searched and searched and can't find an answer.
I'd like to log the message ID for each email sent so I can more accurately do bounce handling.
I'm using the AWS PHP SDK to send my emails. How can I get the message ID after I send an email?
Upvotes: 4
Views: 5352
Reputation: 1710
Updated answer: sendEmail returns a Guzzle\Service\Resource\Model.
You can get the value of MessageId with $response->get('MessageId')
More info: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/feature-models.html
Upvotes: 2
Reputation: 762
You can get the response from amazon into a variable and then parse the xml;
$res = $this->amazon_ses->send();
$xml = new SimpleXMLElement($res);
$email_id = (string) $xml->SendEmailResult[0]->MessageId;
This worked well for me
Upvotes: 1
Reputation: 180
Found the answer...
I'm able to retrieve the MessageID from the response object I get upon sending an email with SES.
$response->body->SendEmailResult->MessageId
Upvotes: 4