Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging Amazon SES Message ID

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?

like image 243
Matt Clements Avatar asked Feb 20 '23 03:02

Matt Clements


2 Answers

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

like image 163
Matt Clements Avatar answered Mar 04 '23 09:03

Matt Clements


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

like image 35
Mark Kasson Avatar answered Mar 04 '23 09:03

Mark Kasson