error in send email using Mandrill (php) -
i using mandrill api first time. using following code. have mandrill api key me.
<?php try { $mandrill = new mandrill('your_api_key'); $message = array( 'html' => '<p>example html content</p>', 'text' => 'example text content', 'subject' => 'example subject', 'from_email' => 'message.from_email@example.com', 'from_name' => 'example name', 'to' => array( array( 'email' => 'recipient.email@example.com', 'name' => 'recipient name' ) ), 'headers' => array('reply-to' => 'message.reply@example.com'), 'important' => false, 'track_opens' => null, 'track_clicks' => null, 'auto_text' => null, 'auto_html' => null, 'inline_css' => null, 'url_strip_qs' => null, 'preserve_recipients' => null, 'view_content_link' => null, 'bcc_address' => 'message.bcc_address@example.com', 'tracking_domain' => null, 'signing_domain' => null, 'return_path_domain' => null, 'merge' => true, 'global_merge_vars' => array( array( 'name' => 'merge1', 'content' => 'merge1 content' ) ), 'merge_vars' => array( array( 'rcpt' => 'recipient.email@example.com', 'vars' => array( array( 'name' => 'merge2', 'content' => 'merge2 content' ) ) ) ), 'tags' => array('password-resets'), 'subaccount' => 'customer-123', 'google_analytics_domains' => array('example.com'), 'google_analytics_campaign' => 'message.from_email@example.com', 'metadata' => array('website' => 'www.example.com'), 'recipient_metadata' => array( array( 'rcpt' => 'recipient.email@example.com', 'values' => array('user_id' => 123456) ) ), 'attachments' => array( array( 'type' => 'text/plain', 'name' => 'myfile.txt', 'content' => 'zxhhbxbszsbmawxl' ) ), 'images' => array( array( 'type' => 'image/png', 'name' => 'imagecid', 'content' => 'zxhhbxbszsbmawxl' ) ) ); $async = false; $ip_pool = 'main pool'; $send_at = 'example send_at'; $result = $mandrill->messages->send($message, $async, $ip_pool, $send_at); print_r($result); } catch(mandrill_error $e) { echo 'a mandrill error occurred: ' . get_class($e) . ' - ' . $e->getmessage(); throw $e; } ?>
by using code getting error as:
a mandrill error occurred: mandrill_httperror - api call messages/send failed: error setting certificate verify locations: cafile: /usr/local/share/certs/ca-root-nss.crt capath: none
why getting error?
the error indicating don't have required ssl cert installed locally verify ssl connection mandrill's api. can bundle of certs through package manager operating system, or can download bundle that's distributed mozilla: http://curl.haxx.se/docs/caextract.html , store them locally.
Comments
Post a Comment