AWS SES Failed to connect() to host or proxy

27 Views Asked by At

I'm running a basic connection in AWS SES with PHP to send transactional emails using a SMTP user following the instructions step by step, everything is verified, identity and custom MAIL FROM domain. I'm getting error 7: Failed to connect() to host or proxy.

Error executing "SendEmail" on "https://email.us-east-1.amazonaws.com" class SesClient AWS HTTP error: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://email.us-east-1.amazonaws.com

My code:

require('vendor/autoload.php');

use Aws\Ses\SesClient;
use Aws\Exception\AwsException;

$user='***********';
$password='***************';

//--------------- inicializa clase ---------------
$SesClient = new SesClient([
    'version' => '2010-12-01',
    'region'  => 'us-east-1',
    'credentials' => [
        'key'    => $user,
        'secret' => $password
    ]
]);

If I check with the SSH everything is ok

openssl s_client -crlf -quiet -starttls smtp -connect email-smtp.us-east-1.amazonaws.com:587

depth=2 C = US, O = Amazon, CN = Amazon Root CA 1 verify return:1 depth=1 C = US, O = Amazon, CN = Amazon RSA 2048 M01 verify return:1 depth=0 CN = email-smtp.us-east-1.amazonaws.com verify return:1 250 Ok

1

There are 1 best solutions below

0
Zeke On

The cURL 7 error means that an outgoing connection was blocked. I was looking at the server where I host the website and found a lot of outgoing connections blocked, I simply added the AWS connections and put them in the list of allowed connections. There are several, for example: ec2-52-202-194-26.compute-1.amazonaws.com