Find file History
Latest commit 4981d05 Oct 20, 2016
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
examples MAIL-468: Converting Api wrapper to Object based Aug 31, 2015
Mailin.php Removed CURLOPT_FOLLOWLOCATION from curl to prevent safe_mode/open_ba… Oct 12, 2016
README.md UPdtaed readme Oct 20, 2016

README.md

SendinBlue Php Library

This is the SendinBlue Php library. It implements the various exposed APIs that you can read more about on https://apidocs.sendinblue.com.

Installation and Quickstart

  • You will need to first get the Access key from SendinBlue.

  • Our library supports a timeout value, default is 30,000 MS ( 30 secs ), which you can pass as 3rd parameter in Mailin class Object.

  • Assuming that you have cloned this git repo, or downloaded Mailin.php and its in the same directory than the script. You can use this small sample script to get started.

<?php
require('Mailin.php');
/*
 * This will initiate the API with the endpoint and your access key.
 *
 */
$mailin = new Mailin('https://api.sendinblue.com/v2.0','Your access key', 5000);	// Optional parameter: Timeout in MS

/** Prepare variables for easy use **/ 

$data = array( "to" => array("to@example.net"=>"to whom!"),
			"cc" => array("cc@example.net"=>"cc whom!"),
			"bcc" =>array("bcc@example.net"=>"bcc whom!"),
			"from" => array("from@email.com","from email!"),
			"replyto" => array("replyto@email.com","reply to!"),
			"subject" => "My subject",
			"text" => "This is the text",
			"html" => "This is the <h1>HTML</h1><br/>
					   This is inline image 1.<br/>
					   <img src=\"{myinlineimage1.png}\" alt=\"image1\" border=\"0\"><br/>
					   Some text<br/>
					   This is inline image 2.<br/>
					   <img src=\"{myinlineimage2.jpg}\" alt=\"image2\" border=\"0\"><br/>
					   Some more text<br/>
					   Re-used inline image 1.<br/>
					   <img src=\"{myinlineimage1.png}\" alt=\"image3\" border=\"0\">",
			"attachment" => array(),
			"headers" => array("Content-Type"=> "text/html; charset=iso-8859-1","X-param1"=> "value1", "X-param2"=> "value2",...,"X-Mailin-custom"=>"my custom value", "X-Mailin-IP"=> "102.102.1.2", "X-Mailin-Tag" => "My tag"),
			"inline_image" => array('myinlineimage1.png' => "your_png_files_base64_encoded_chunk_data",'myinlineimage2.jpg' => "your_jpg_files_base64_encoded_chunk_data")
);

var_dump($mailin->send_email($data));

?>

Available functions

List of API calls that you can make, you can click to read more about it. Please do note that the order of parameters are important.

Campaign calls

SMTP calls

SMS call

####Recommendation:

If you face any error like "Curl error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:func(144):reason(134)\n", with our library then by adding the below line of code just before curl_exec() ( line no. 46 ) in mailin.php file, you may no longer face this issue.

curl_setopt($ch, CURLOPT_CAINFO, "PATH_TO/cacert.pem");

The content of the file is available here: http://curl.haxx.se/ca/cacert.pem