PHP SES on PHP错误:无法确定要授权的服务/操作名称

时间:2015-01-15 06:24:52

标签: php amazon-web-services email amazon-ses

我正在尝试使用以下PHP脚本使用AWS SES发送电子邮件:

<?php

    require_once("phar://aws.phar");
    use Aws\Ses\SesClient;

    //Open client
    $client = SesClient::factory(array(
        "key" => "key",
        "secret" => "secret",
        "region" => "region"
    ));

    $subject = "subject";
    $messageText = "text message";
    $messageHtml = "<h1>formatted message</h1>";

    //Send email
    try{

        $response = $client->sendEmail(
            array(
                'Source' => 'verified_email@domain.com',
                'Destination' => array(
                    'ToAddresses' => array('an_address@domain.com')
                ),
                'Message' => array(
                    'Subject' => array('Data' => $subject), 
                    'Body' => array('Text' => array('Data' => $messageText)), 
                    'Html' => array('Data' => $messageHtml)
                )
            )
        );

    }catch(Exception $e){
        //An error happened and the email did not get sent
         echo($e->getMessage());
    }
?>

每当我运行它时,它会转到catch子句并在屏幕上显示消息:

Unable to determine service/operation name to be authorized

这并没有真正给我任何关于错误的信息,并且API页面上没有关于此的文档。有什么想法吗?

0 个答案:

没有答案