daniel-zahariev / php-aws-ses

PHP classes that interfaces Amazon Simple Email Service
307 stars 100 forks source link

Script Automatically Sets Region #4

Closed nagarjun closed 10 years ago

nagarjun commented 10 years ago

Is there any reason why I am only able to make calls to the US East region?

nagarjun commented 10 years ago

Found the culprit. The script automatically sets the region. It would be nice if we could pass that as well in the parameters.

daniel-zahariev commented 10 years ago

You can pass it in the constructor: https://github.com/daniel-zahariev/php-aws-ses/blob/master/src/SimpleEmailService.php#L80

nagarjun commented 10 years ago

@daniel-zahariev Fixed it. Thanks for this amazing library. Now, I'm not able to send emails on my production server but able to send on my local server. I get the following 3 errors:

Message: curl_setopt(): CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead
Filename: vendor/SimpleEmailServiceRequest.php
Line Number: 94

Message: Undefined property: SimpleEmailServiceRequest::$resource
Filename: vendor/SimpleEmailServiceRequest.php
Line Number: 129

Message: SimpleEmailService::sendEmail(): 60 SSL certificate problem: unable to get local issuer certificate
Filename: vendor/SimpleEmailService.php
Line Number: 366

I'm using MAMP and I am able to send without errors but my teammate who runs Windows also gets these errors and I get the same errors in my production server. Any clue how I can solve this? Appreciate your help again.

daniel-zahariev commented 10 years ago

As i see you have two different issues: 1) your cURL library doesn't support value 1 (check http://php.net/manual/en/function.curl-setopt.php) - i've just fixed this in the repo 2) you need to set CURLOPT_CAINFO because it seems cURL does not know where to look for ca certificates. So add code like this before your call (update to latest version of the repo first):

SimpleEmailServiceRequest::$curlOptions = array(CURLOPT_CAINFO => 'E:\path\to\curl-ca-bundle.crt');

(curl-ca-bundle.crt comes with cURL - you can download curl and just grab this file - libcurl is included in php so you don't need to install curl if you only want to use curl in php)

Note that most of the code of this library was written by Dan Myers and i'm merely supporting and extending the library.

cyril-bouthors commented 10 years ago

This message just to confirm that I was successfully able to send email via region EU West-1 with the correct Git version of the library when passing 'email.eu-west-1.amazonaws.com' as the third argument to new SimpleEmailService().

daniel-zahariev commented 10 years ago

Thanks!