An open API service indexing awesome lists of open source software.

https://github.com/envialosimple-dev/transaccional-php

PHP SDK for EnvíaloSimple Transaccional
https://github.com/envialosimple-dev/transaccional-php

email envialosimple library php sdk transactional

Last synced: 6 months ago
JSON representation

PHP SDK for EnvíaloSimple Transaccional

Awesome Lists containing this project

README

          

# EnvíaloSimple Transaccional - PHP SDK

## Installation

```bash
composer require envialosimple/transaccional
```

## Basic Usage

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

$estr = new Transaccional($your_api_key);

$mailParams = new MailParams();

$mailParams
->setFrom('no-reply@mycompany.com', 'MyCompany Notifications')
->setTo('john.doe@example.com', 'John Doe')
->setReplyTo('do-reply@mycompany.com')
->setPreviewText('A glimpse of what comes next...')
->setSubject('This is a subject')
->setHtml('

HTML emails are cool, {{ name }}

')
->setText('Text emails are also cool, {{ name }}')
->setContext(['name' => 'John'])
;

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

## Multiple Recipients Usage

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

$estr = new Transaccional($your_api_key);

$mailParams = new MailParams();

$mailParams
->setFrom('no-reply@mycompany.com', 'MyCompany Notifications')
->setTo([
["email" => 'john.doe@example.com', "name" => 'John Doe'],
["email" => 'jane.doe@example.com', "name" => 'Jane Doe'],
["email" => 'sean.doe@example.com']
])
->setReplyTo('do-reply@mycompany.com')
->setPreviewText('A glimpse of what comes next...')
->setSubject('This is a subject')
->setHtml('

HTML emails are cool, {{ name }}

')
->setText('Text emails are also cool, {{ name }}')
->setContext(['name' => 'John'])
;

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