Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have used the following code for sending mail using php using amazon ec2, but I only see 'aatest' as the result, and doesn't get any incoming email. Btw, I have already included ses.php, and have validated the email contact@mydomain.com, and double confirm that accesskey, and accesskey are the correct one. Can anyone suggest way for debugging it?

require_once('ses.php');
$con=new SimpleEmailService('accesskey','accesskey');
print_r('aa'.$con->listVerifiedEmailAddresses());


$m = new SimpleEmailServiceMessage();
$m->addTo('contact@mydomain.com');
$m->setFrom('contact@mydomain.com');
$m->setSubject('Hello, world!');
$m->setMessageFromString('This is the message body.');
print_r($con->sendEmail($m));
echo 'test';
share|improve this question
    
Have you tried putting error_reporting(E_ALL); at the top of your code? Have you tried disabling the SSL certificate check by doing $con->enableVerifyHost(false); $con->enableVerifyPeer(false);? –  ub3rst4r Sep 17 '12 at 3:33
    
Yes, it works by adding $con->enableVerifyHost(false); $con->enableVerifyPeer(false); ! What is the reason for that? Btw, could you post it as an answer, so I could accept it :) –  william007 Sep 17 '12 at 5:10
add comment

1 Answer 1

up vote 2 down vote accepted

Disable the SSL certificate check with the following lines:

$con->enableVerifyHost(false);
$con->enableVerifyPeer(false);

The reason its failing the SSL certificate verification is because the certificate for SES is not recognized by the default CA (Certificate Authority) loaded with cURL. I believe you have to generate your own certificate for AWS by going to https://portal.aws.amazon.com/gp/aws/securityCredentials and clicking on "X.509 Certificates" and "Create a new certificate". You will then be able to download the certificate. However, unless your knowledgeable about PHP you won't be able to include the certificate file with that PHP class. So your best just to disable the verification.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.