How to retrieve response from Amazon SES?

允我心安 提交于 2019-12-10 14:05:00

问题


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


回答1:


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"))



回答2:


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



来源:https://stackoverflow.com/questions/23830383/how-to-retrieve-response-from-amazon-ses

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!