PHP code example of envialosimple / transaccional

1. Go to this page and download the library: Download envialosimple/transaccional 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/ */

    

envialosimple / transaccional example snippets


use EnvialoSimple\Transaccional;
use EnvialoSimple\Transaccional\Helpers\Builder\MailParams;

$estr = new Transaccional($your_api_key);

$mailParams = new MailParams();

$mailParams
    ->setFrom('[email protected]', 'MyCompany Notifications')
    ->setTo('[email protected]', 'John Doe')
    ->setReplyTo('[email protected]')
    ->setPreviewText('A glimpse of what comes next...')
    ->setSubject('This is a subject')
    ->setHtml('<h1>HTML emails are cool, {{ name }}</h1>')
    ->setText('Text emails are also cool, {{ name }}')
    ->setContext(['name' => 'John'])
    ;

$estr->mail->send($mailParams);

use EnvialoSimple\Transaccional;
use EnvialoSimple\Transaccional\Helpers\Builder\MailParams;

$estr = new Transaccional($your_api_key);

$mailParams = new MailParams();

$mailParams
    ->setFrom('[email protected]', 'MyCompany Notifications')
    ->setTo([
        ["email" => '[email protected]', "name" => 'John Doe'],
        ["email" => '[email protected]', "name" => 'Jane Doe'],
        ["email" => '[email protected]']                   
    ])
    ->setReplyTo('[email protected]')
    ->setPreviewText('A glimpse of what comes next...')
    ->setSubject('This is a subject')
    ->setHtml('<h1>HTML emails are cool, {{ name }}</h1>')
    ->setText('Text emails are also cool, {{ name }}')
    ->setContext(['name' => 'John'])
    ;

$estr->mail->send($mailParams);