postmark-php
postmark-php copied to clipboard
Solving SSL issue when using autoload.php
Instead of using Composer I downloaded the bundle zip (v2.1) and am experiencing an SSL error:
exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate
Further to the advice in the wiki (https://github.com/wildbit/postmark-php/wiki/SSL%20Errors%20on%20Windows) I tried to include this line in my php:
PostmarkClientBase::$VERIFY_SSL = false;
But because I'm using the autoload.php method (as recommended) the error is now:
Fatal error: Class 'PostmarkClientBase' not found
What is the recommended method of combining use of autoload.php and disabling SSL ?
My update (for future reference):
When using the basic sample, the SSL work-around should set the flag on $client e.g.:
$client = new PostmarkClient("SECRET_KEY");
$client::$VERIFY_SSL = false;
$sendResult = $client->sendEmail("[email protected]",
"[email protected]",
"Hello from Postmark!",
"This is just a friendly 'hello' from your friends at Postmark.");
Perhaps the team might look into updating the wiki page with a clarification for people who are getting started with the basic example, but not using SSL.
Hi @robinmackenzie, this is a little bit peculiar. The static assignment of PostmarkClientBase::$VERIFY_SSL = false;
should have worked, so I am surprised that $client::$VERIFY_SSL = false;
worked instead. We typically don't recommend people disabling or tampering with SSL settings, since this can leave your API Key and emails open to eavesdropping. However, it does come up from time to time, and we have a page that is dedicated to a few different options for solving it: https://github.com/wildbit/postmark-php/wiki/Dealing-with-SSL-Errors