【发布时间】:2016-02-01 03:27:40
【问题描述】:
在让 AWS SES 按以下方式工作时遇到一些问题;我想从我的网站向用户发送电子邮件。看起来凭证没有得到验证,但是我使用了从 IAM 生成的正确凭证(我也尝试了服务器根密钥,它给了我同样的错误)。我已经没有关于如何进一步解决/调试的想法,所以任何指导都将不胜感激。
执行时收到错误:
从实例配置文件元数据服务器检索凭据时出错。 (客户端错误:404)
采取的步骤
我已设置 SES 并验证了电子邮件地址等
我创建了一个具有“对 SES 的完全访问权限”的 IAM 配置文件
我已经使用 phar 文件安装了适用于 php 的 AWS 开发工具包
我已经编写了下面的 php 代码,直接提供了 SES 的正确安全访问代码
require 'aws/aws.phar'; use Aws\Ses\SesClient; //More code here $client = SesClient::factory(array( 'key' => 'xxxxxxxxxxxxx', 'secret' => 'xxxxxxxxxxx', 'region' => 'us-west-2', 'version' => '2010-12-01' )); //code to build the $msg here as array try{ $result = $client->sendEmail($msg); //save the MessageId which can be used to track the request $msg_id = $result->get('MessageId'); echo("MessageId: $msg_id"); //view sample output print_r($result); } catch (Exception $e) { echo($e->getMessage()); } //view the original message passed to the SDK print_r($msg);
提前感谢您的帮助 - 这总是一个很棒的社区!如果我能提供其他任何东西,请告诉我
约翰
【问题讨论】:
标签: php amazon-web-services amazon-ec2 amazon-ses