Debesh Nayak Debesh Nayak - 5 years ago 261
PHP Question

Why I can not send Maindrill Mail from development server(localhost)?

I am using Mandrill API to send email.

I have register my send domain and set my DKIM and SPF record properly inside Mandrill Setting page.

Following is my code that is being used to send email:

$template_name = "Test_Schedule_Reminder";
$to_email = "";
$to_name = "Test Email";

$from_email = "";
$from_name = "Debesh Nayak";

require_once 'mandrill-api-php/src/Mandrill.php'; //Not required with Composer
try {
$mandrill = new Mandrill('my-mandrill-api-key');
$message = array(
'html' => $html_email_template,
'subject' => $email_title,
'from_email' => $from_email,
'from_name' => $from_name,
'to' => array(
'email' => $to_email,
'name' => $to_name,
'type' => 'to'
'important' => true,
'track_opens' => true,
'track_clicks' => true,
'inline_css' => true,
'metadata' => array('website' => ''),
$async = false;
$ip_pool = null;
$send_at = $utc_class_time;
$result = $mandrill->messages->send($message, $async, $ip_pool, $send_at);
} catch(Mandrill_Error $e) {
// Mandrill errors are thrown as exceptions
echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
// A mandrill error occurred: Mandrill_Unknown_Subaccount - No subaccount exists with the id 'customer-123'
throw $e;

I am able to send email when I am sending from my production server.

But when I am trying to send email from localhost I am getting the following error:

Mandrill_HttpError - API call to messages/send failed: SSL certificate problem: unable to get local issuer certificate

So how to avoid this SSL certificate problem when testing mail from localhost using Mandrill API.

Answer Source

Do check library files of Mandrill and check cURL call that sending out email. And then checked "CURLOPT_SSL_VERIFYPEER" parameter of it. Set value to false. It should help you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download