Could anyone please shed some light on what would be causing these errors?
I'm using Google App Engine on a development server. First I got this error:
The email was not sent. Error message: Error executing "SendEmail" on "https://email.us-west-2.amazonaws.com"; AWS HTTP error: No system CA bundle could be found in any of the the common system locations. PHP versions earlier than 5.6 are not properly configured to use the system's CA bundle by default. In order to verify peer certificates, you will need to supply the path on disk to a certificate bundle to the 'verify' request option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not need a specific certificate bundle, then Mozilla provides a commonly used CA bundle which can be downloaded here (provided by the maintainer of cURL): https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt. Once you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP ini setting to point to the path to the file, allowing you to omit the 'verify' request option. See http://curl.haxx.se/docs/sslcerts.html for more information.
Then I added google_app_engine.enable_curl_lite = 1
to php.ini and reduced the error to:
The email was not sent. Error message: Error executing "SendEmail" on "https://email.us-west-2.amazonaws.com"; AWS HTTP error: curl_multi_init
I'm beginning to understand that using SES on GAE might require a few tweaks??? What can I do?
My code is 99% from the Amazon documentation. The only difference is that I've hardcoded the credentials array in $client
.
<?php
// Replace path_to_sdk_inclusion with the path to the SDK as described in
// http://docs.aws.amazon.com/aws-sdk-php/v3/guide/getting-started/basic-usage.html
define('REQUIRED_FILE','../aws/aws-autoloader.php');
// Replace sender@example.com with your "From" address.
// This address must be verified with Amazon SES.
define('SENDER', 'me@verified.sender.address.com');
// Replace recipient@example.com with a "To" address. If your account
// is still in the sandbox, this address must be verified.
define('RECIPIENT', 'me@verified.receiver.address.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,
'credentials' => array(
'key' => 'xxx',
'secret' => 'xxx',
)
));
$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"."
");
} catch (Exception $e) {
echo("The email was not sent. Error message: ");
echo($e->getMessage()."
");
}
?>
EDIT:
Once deployed, this works without any edit to php.ini...??