Mandrill CA SSL Errors with cURL

I'm trying mandrill. It looks cute. I registered with an account and received an api key. Download Mandrill PHP shell from https://bitbucket.org/mailchimp/mandrill-api-php

This post seems to have had a very good Mandrill greeting email example, so I tried it:

Simple php function to send email with Mandrill

Holds this error:

API call to templates/add failed: Problem with the SSL CA cert (path? access rights?) 

I followed the instructions from these SO posts:

error sending email using Mandrill (php) HTTPS and SSL3_GET_SERVER_CERTIFICATE: certificate verification failed, CA is OK

Got a .pem file from http://curl.haxx.se/docs/caextract.html

and make sure curl api points to this file inside the Mandrill api

 curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt ($ch, CURLOPT_CAINFO, "pathto/cacert.pem"); 

The .pem file is readable. There are no crazy permissions situations.

There is no help. Same deal:

 API call to templates/add failed: Problem with the SSL CA cert (path? access rights?) 

Googling around I followed CentOS 6.0 steps here: http://kb.kerio.com/product/kerio-connect/server-configuration/ssl-certificates/adding-trusted-root-certificates-to-the-server-1605. html

Like the steps here: http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/

The same mistakes. As a last attempt, I installed curl to completely ignore ssl-step. This, of course, is not recommended, but I just wanted to feel the solid ground under my feet. I returned to Mandrill.php and did this.

 curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0); 

Again, the same mistake. I was wondering if anyone else could shed light on this for me. I have run out of Google. (This gave me a recaptcha because I used it too much). Thank you for your time!

(System: CentOS 6.5, PHP 5.3)

+5
source share
1 answer

It is strange that you have this problem on Linux (a known problem on Windows).

The only thing I think that you are trying to load the default .pem file through your php.ini file, check curl.cainfo and set the absolute path to cacert.pem -file. This should make it so that you do not need to use CURLOPT_CAINFO - and perhaps gives a better result?

Half off topic; if you do not need all the functions provided by the API, you can also use an SMTP connection (it is always easier to work).

0
source

Source: https://habr.com/ru/post/1203826/


All Articles