duanlvxi8652 2016-09-01 20:40
浏览 67

使用PHP SDK的Amazon SES不起作用?

I've been trying to send emails using Amazon SES SDK with PHP and since I've switched hosts this doesn't work. Here's my script:

$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

As I mentioned, this works fine on localhost and on my old hosting account but it doesn't work on the servers of my new hosting provider. The script doesn't work and no error report is shown, just a blank page...

I tried to echo a line after the second comment but it doesn't show up anything so I suppose it's an issue when requesting the aws.phar (the file is present in the appropriate folder)

I think it might be an issue on the webhosting company's side, does anyone have any ideas?

  • 写回答

1条回答 默认 最新

  • duanjiao2978 2016-09-01 22:16
    关注

    It looks like the issue was an old PHP version. If anyone experiences this, simply go into cPanel -> "Select PHP Version" and switch your PHP version to a newer one and select all the necessary extensions. I switched to PHP 7.0 and this now works fine.

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行