我已经注册了Amazon SES服务,并设置了电子邮件限制和沙盒以外的权限。我尝试了许多PHPMailer函数,但都返回错误:连接超时(110)。是否可能使用PHPMailer发送邮件?
我在Amazon SES网站上看到了这个链接:link。
我已复制所有代码,并将我的变量替换为演示脚本中显示的变量。现在我收到了错误信息:必须使用KEY和SECRET_KEY才能使用此脚本......我应该在哪里放入我的KEY和SECRET_KEY?没有解释如何操作。
是否有其他方法可以通过Amazon SES服务发送电子邮件? 谢谢!
我在Amazon SES网站上看到了这个链接:link。
<?php
// Replace path_to_sdk_inclusion with the path to the SDK as described in
// http://docs.aws.amazon.com/aws-sdk-php/v2/guide/quick-start.html
define('REQUIRED_FILE','path_to_sdk_inclusion');
// Replace sender@example.com with your "From" address.
// This address must be verified with Amazon SES.
define('SENDER', 'sender@example.com');
// Replace recipient@example.com with a "To" address. If your account
// is still in the sandbox, this address must be verified.
define('RECIPIENT', 'recipient@example.com');
// Replace us-west-2 with the AWS region you're using for Amazon SES.
define('REGION','us-west-2');
define('SUBJECT','Amazon SES test (AWS SDK for PHP)');
define('BODY','This email was sent with Amazon SES using the AWS SDK for PHP.');
require REQUIRED_FILE;
use Aws\Ses\SesClient;
$client = SesClient::factory(array(
'version'=> 'latest',
'region' => REGION
));
$request = array();
$request['Source'] = SENDER;
$request['Destination']['ToAddresses'] = array(RECIPIENT);
$request['Message']['Subject']['Data'] = SUBJECT;
$request['Message']['Body']['Text']['Data'] = BODY;
try {
$result = $client->sendEmail($request);
$messageId = $result->get('MessageId');
echo("Email sent! Message ID: $messageId"."\n");
} catch (Exception $e) {
echo("The email was not sent. Error message: ");
echo($e->getMessage()."\n");
}
?>
我已复制所有代码,并将我的变量替换为演示脚本中显示的变量。现在我收到了错误信息:必须使用KEY和SECRET_KEY才能使用此脚本......我应该在哪里放入我的KEY和SECRET_KEY?没有解释如何操作。
是否有其他方法可以通过Amazon SES服务发送电子邮件? 谢谢!