我在
Windows Apache服务器上安装了Mandrill
PHP API.当尝试使用以下代码发送电子邮件时,我收到错误:
Mandrill_HttpError – 对消息/发送模板的API调用失败:SSL证书问题:无法获取本地颁发者证书
我不清楚Mandrill如何连接到我的本地发行人证书.我的Web服务器确实有一个有效的证书,可以成功显示HTTPS页面.
有任何想法吗?
$mandrill = new Mandrill('MyMandrillAPIKey'); $message = array( 'subject' => 'Test message','from_email' => 'MyEmailAddress','html' => '<p>this is a test message with Mandrill\'s PHP wrapper!.</p>','to' => array(array('email' => 'MyEmailAddress','name' => 'David Splat')),'merge_vars' => array(array( 'rcpt' => 'MyEmailAddress','vars' => array( array( 'name' => 'FIRSTNAME','content' => $fName),array( 'name' => 'LASTNAME','content' => $lName) )))); $template_name = 'MyTemplateName'; $template_content = array( array( 'name' => 'main','content' => 'Hi *|FIRSTNAME|* *|LASTNAME|*,thanks for signing up.'),array( 'name' => 'footer','content' => 'Copyright 2014.') ); print_r($mandrill->messages->sendTemplate($template_name,$template_content,$message)); } catch(Mandrill_Error $e) { // Mandrill errors are thrown as exceptions echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(); throw $e; }
您不需要关闭curl SSL选项,而是可以从
http://curl.haxx.se/docs/caextract.html下载cacert.pem文件,然后将其包含在PHP.ini文件中
curl.cainfo = “/确切/位置/到/ cacert.pem”
原文链接:https://www.f2er.com/php/136066.htmlcurl.cainfo = “/确切/位置/到/ cacert.pem”
或者只是更改Mandrill.PHP文件中的行以使用它,如下所示.
curl_setopt ($this->ch,CURLOPT_SSL_VERIFYPEER,TRUE); curl_setopt ($this->ch,CURLOPT_CAINFO,__DIR__ . "/cacert.pem")
link to the post http://tutewall.com/ssl-certificate-problem-unable-to-get-local-issuer-certificate/