我正在使用 Amazon SES (V3) 的 getEmailIdentity SDK 功能,在文档中他们提供了响应,但当我使用它时,没有得到任何响应。
try {
$sesClient = $this->getSESClient();
// Retrieve the object
$result = $sesClient->getEmailIdentity([
'EmailIdentity' => 'rathor.in', // REQUIRED
]);
if ($result) {
return ['success'=> true, 'message' =>"Domain successfully found.", 'response' =>$result];
}
return ['success'=> true, 'message' =>"No domain found!"];
} catch (AwsException $e) {
return ['success'=> false, 'message' =>$e->getMessage()];
}
任何人都可以帮助我,为什么我得到不同的结果?
谢谢
由于您尚未分享您如何创建
SesV2Client
,因此请确保您使用正确的'version' => '2019-09-27'
和region
。以下是拨打 GetEmailIdentity
电话的工作示例。
use Aws\SesV2\SesV2Client;
use Aws\Exception\AwsException;
$SesClient = new SesV2Client([
'profile' => 'default',
'version' => '2019-09-27',
'region' => 'ap-south-1'
]);
$emailIdentity = '[email protected]';
try {
$result = $SesClient->getEmailIdentity([
'EmailIdentity' => $emailIdentity,
]);
var_dump($result);
} catch (AwsException $e) {
// output error message if fails
echo $e->getMessage();
echo "\n";
}
希望能有所帮助。