5

I'm trying out Mandrill. It looks nice. I signed up with an account and got an api key. Downloaded the Mandrill PHP wrapper from https://bitbucket.org/mailchimp/mandrill-api-php

This post seemed to have a pretty good hello-world Mandrill email example, so I tried it out:

Simple php function to send an email with Mandrill

Kept getting this error:

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

I followed the instructions from these S.O. posts:

error in send email using Mandrill (php) HTTPS and SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK

Grabbed the .pem file from http://curl.haxx.se/docs/caextract.html

and made sure the the curl api pointed to that 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. No crazy permissions situations.

No help. Same deal:

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

Googling around I followed the 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

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

Same error. As a last try, I set curl to ignore the ssl-step entirely. This of course is not advised, but I just wanted to feel solid ground under my feet. I went back into Mandrill.php and gave this a shot.

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

Again, same error. I was wondering if someone else can shed some light on this for me. I've exhausted google. (It gave me a recaptcha because I was using it too much). Thanks for your time!

(System: CentOS 6.5, PHP 5.3)

Community
  • 1
  • 1
CodeOwl
  • 662
  • 2
  • 9
  • 23

1 Answers1

0

Odd that you're having this issue on Linux (known problem in Windows though).

The only thing I kan think of is that you try to load the the .pem as a default via your php.ini-file, check curl.cainfo and supply an absolute path to the cacert.pem-file. That should make so that you don't have to use CURLOPT_CAINFO – and perhaps gives a better result?

Half off-topic; if you don't need all the features that the API gives you, you can also use an SMTP-connection (always easier to work with).

Marcus Olsson
  • 2,485
  • 19
  • 35