mailgun-php: localhost development - SSL certificate problem
I’m running my dev site on PHP’s built-in development server (php -S localhost:8000).
The basic code I’m using to send e-mail is as follows:
function email_pdf($pdf, $recipient)
{
$client = new \Http\Adapter\Guzzle6\Client();
$mgClient = new Mailgun\Mailgun('my-api-key', $client);
$result = $mgClient->sendMessage(
'my-domain',
[
'from' => 'e-mail server <mailgun@my-domain>',
'to' => $recipient,
'subject' => 'subject',
'html' => 'html content'
],
[
'attachment' => [
// this structure is documented as "backwards compatibility" in code,
// even though your documentation offers no other way - WTF?
'filePath' => $pdf,
'remoteName' => 'bill.pdf',
]
);
return $result;
}
I’ve downloaded the libraries today, so the versions are mailgun/mailgun-php v2.0, php-http/guzzle6-adapter 1.1.1.
This code throws a Http\Client\Exception\RequestException with the message cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html).
What can be done to make this work?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 27
What about this?
@Nyholm Thanks, that makes sense.
https://github.com/mailgun/mailgun-php/blame/master/README.md#L166 https://github.com/mailgun/mailgun-php/blob/v2.0/src/Mailgun/Mailgun.php#L156 I think you don’t have v2.0.
P.S. “depreciate” != “deprecate”. https://en.wikipedia.org/wiki/Deprecation
+1 2.0 is currently unusable for me. I’m having the same problem as jurchiks.
I had this problem (not with mailgun though) and it was fixed by amending the php.ini file
and putting the correct cacert.pem in the php/extras folder.