Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

php - AWS SDK Guzzle error when trying to send a email with SES

Getting a weird error I have no idea how to fix. This is the error:

( ! ) Catchable fatal error: Argument 2 passed to GuzzleServiceClient::getCommand() must be an array, string given, called in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php on line 93 and defined in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php on line 113
Call Stack
#   Time    Memory  Function    Location
1   0.0009  676280  {main}( )   ..	est.php:0
2   0.0557  3311632 AwsSesSesClient->send_email( )    ..	est.php:30
3   0.0557  3312128 AwsCommonClientAbstractClient->__call( ) ..	est.php:30
4   0.0557  3312208 GuzzleServiceClient->__call( )    ..(null):103
5   0.0557  3312296 GuzzleServiceClient->getCommand( )    ..(null):93

This is the code I used (straight from the AWS page)

$client = SesClient::factory(array(
    'key'    => '',
    'secret' => '',
    'region' => 'us-east-1'
));

$response = $client->send_email(
    '[email protected]', // Source (aka From)
    array('ToAddresses' => array( // Destination (aka To)
        '[email protected]'
    )),
    array( // Message (short form)
        'Subject.Data' => 'Email Test ' . time(),
        'Body.Text.Data' => 'This is a simple test message ' . time()
    )
);

// Success?
var_dump($response->isOK());

UPDATE!!!:

Fixed the issues above, now I got an SSL certificate issue:

GuzzleHttpExceptionCurlException: [curl] 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed [url] https://email.us-east-1.amazonaws.com/ in phar://C:/wamp/www/PHPCodeLance/WebTech/Projects/MIB v2/lib/aws/aws.phar/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php on line 578

Thanks in advance

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For an answer to the first (now supposedly resolved - HOW?) issue, see AWS SDK Guzzle error when sending email with SES

Please, if you have a solution to an issue, particularly one as arcane as this, POST IT for others to use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...