Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve response from Amazon SES?

I have the code to verify email address in Amazon ses

<?php
$sesClient = SesClient::factory(array(
            'key'    => 'secret key',
            'secret' => 'secret',
            'profile' => 'user_name',
            'region'  => 'us-east-1'
        ));
$result = $sesClient->verifyEmailAddress(array('EmailAddress'=> $email));
?>

My output for $result is like this:

object(Guzzle\Service\Resource\Model) {
    [protected] structure => null
    [protected] data => array()
}

I actually got verified email in the email id I have specified. My question is, how to check whether the function worked correctly using the response I have received? In earlier Amazon web services, they used $result->is('Ok') to verify the result. what function should I use now to check the result for success and failure of that function?

I've checked with the amazon link and still can't find the function for successful response

like image 320
Ganesh Babu Avatar asked Sep 30 '22 17:09

Ganesh Babu


2 Answers

I believe you need to use verifyEmailIdentity not verifyEmailAddress:

$result = $sesClient->verifyEmailIdentity(array('EmailAddress'=> $email));

As stated in the AWS documentation:

The VerifyEmailAddress action is deprecated as of the May 15, 2012 release of Domain Verification. The VerifyEmailIdentity action is now preferred.

Further Reading

like image 166
l'L'l Avatar answered Oct 18 '22 10:10

l'L'l


Looking at tests of aws-sdk-php found this:

https://github.com/aws/aws-sdk-php/blob/master/tests/Aws/Tests/Ses/Integration/IntegrationTest.php#L86

Maybe you can try:

$sesClient->verifyEmailAddress(array('EmailAddress'=> $email));
$sesClient->waitUntilIdentityExists(array('Identities' => array($email)));
$result = $sesClient->getIdentityVerificationAttributes(array('Identities' => array($email)));
if ('Success' === $result->getPath("VerificationAttributes/{$email}/VerificationStatus"))
like image 43
Droga Mleczna Avatar answered Oct 18 '22 08:10

Droga Mleczna