PHP code example of scoringline / sendinblue-api

1. Go to this page and download the library: Download scoringline/sendinblue-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

scoringline / sendinblue-api example snippets




coringline\SendinblueApi\Sendinblue;

$sendinblue = new Sendinblue();

$sendinblue->useAuthentication('ApiKey', ['key' => 'YourPrivateApiKey']);



coringline\SendinblueApi\Sendinblue;

$sendinblue = new Sendinblue();

$sendinblue->getSmsApi()->sendSms('+33600000000', 'Your name', 'The message you want to send');



coringline\SendinblueApi\Sendinblue;
use Scoringline\SendinblueApi\Model\Email;
use Symfony\Component\HttpFoundation\File\File;

$sendinblue = new Sendinblue();

// Send basic email without model    
$sendinblue
    ->getEmailApi()
    ->sendSimpleEmail(
        ['[email protected]', 'from name!'], 
        ['[email protected]' => 'to name!'], 
        'Subject', 
        '<h1>Html</h1> message you want to send'
    )
;      

// Send basic email with array data
$params = [
   'to' => ['[email protected]' => 'to name!'],
   'from' => ['[email protected]', 'from name!'],
   'subject' => 'Subject',
   'html' => '<h1>Html</h1> message you want to send'
];

$email->getEmailApi()->sendEmailWithData($params);

// Send advance email with attachment
$file = new File('fixtures/test.txt');
$email = new Email($sendinblue->getEmailApi());
$email
    ->setTo(['[email protected]' => 'to name!'])
    ->setFrom(['[email protected]', 'from name!'])
    ->setSubject('Subject')
    ->setText('Option text')
    ->setHtml('<h1>Html</h1> message you want to send')
    ->setAttachments(['fixtures/logo.png', $file])
    ->setInlineImages(['fixtures/logo.png', 'fixtures/logo_one.png'])
;
    
$sendinblue->getEmailApi()->sendEmail($email);        
    
// Send advance email with cc, bcc etc
$email
    ->setTo(['[email protected]' => 'to name!'])
    ->setFrom(['[email protected]', 'from name!'])
    ->setSubject('Invitation')
    ->setText('You are invited for giving test');
    ->setHtml('This is the <h1>HTML</h1>')
    ->setReplyTo(['[email protected]', 'replyto name'])
    ->setCc(['[email protected]' => 'cc name'])
    ->setBcc(['[email protected]' => 'Bcc name'])
;

$sendinblue->getEmailApi()->sendEmail($email);