Site icon GetCodify

Integrating send in blue Transactional Email using PHP

sendinblue logo

sendinblue

Sendinblue API can be used by platforms developed in various languages like PHP, Java, Node.js, Python, C# and Ruby.

Integrating send in blue to your site PHP

Before Starting If you want to know how to set up the send in blue dashboard before integration click link to know more:  How to Integrate Sendinblue Transactional Email

  1. Download the SendinBlue SMTP Library “Mailin.php” from https://github.com/DTSL/mailin-smtp-api.git
  2. Simply copy that file to your PHP project / includes it your project then add below PHP code and configure.
require('../mailin.php');
    $mailin = new Mailin("https://api.sendinblue.com/v2.0","your access key"); //here add your API KEY
    $data = array( "to" => array("to@example.net"=>"to whom!"),
        "from" => array("from@email.com", "from email!"),
        "subject" => "My subject",
        "html" => "This is the <h1>HTML</h1>",
        "attachment" => array("https://domain.com/path-to-file/filename1.pdf", "https://domain.com/path-to-file/filename2.jpg")//add attachments if you need else you can just remove this line
	);
 
    var_dump($mailin->send_email($data));

 

Exit mobile version