我一直在尝试使用Amazon SES SDK和PHP发送电子邮件,但由于我切换了主机,这不起作用。下面是我的脚本:
$usrMessage = 'hello, just testing';
$usrTo = 'test@test.com';
//Amazon SES - Getting the client ready
require 'amazon/aws.phar';
use Aws\Ses\SesClient;
error_reporting(1);
@ini_set('display_errors', 1);
$client = SesClient::factory(array(
'key' => '[private]',
'secret' => '[private]',
'region' => 'eu-west-1'
));
//End of Amazon SES
$msg = array();
$msg['Source'] = "Test <test@test.com>";
//ToAddresses must be an array
$msg['Destination']['ToAddresses'][] = $usrTo;
$msg['Message']['Subject']['Data'] = "Download Link for your Freebie";
$msg['Message']['Subject']['Charset'] = "UTF-8";
$msg['Message']['Body']['Text']['Data'] ="Text data of email";
$msg['Message']['Body']['Text']['Charset'] = "UTF-8";
$msg['Message']['Body']['Html']['Data'] = $usrMessage;
$msg['Message']['Body']['Html']['Charset'] = "UTF-8";
$result = $client->sendEmail($msg);
//End of Amazon SES Script正如我所提到的,这在localhost和我的旧主机帐户上工作得很好,但它不能在我的新主机提供商的服务器上工作。脚本不起作用,也不显示错误报告,只显示一个空白页面...
我试图回显第二个注释后面的一行,但没有显示任何内容,所以我认为这是请求aws.phar时的问题(该文件位于适当的文件夹中)
我认为这可能是网络托管公司的一个问题,有谁有什么想法吗?
发布于 2016-09-02 06:16:10
看起来这个问题是一个旧的PHP版本。如果有人遇到这种情况,只需进入PHP ->“选择PHP版本”,将你的PHP版本切换到一个较新的版本,并选择所有必要的扩展。我切换到PHP7.0,现在可以正常工作了。
https://stackoverflow.com/questions/39280531
复制相似问题