2020-04-09 12:55:07 +02:00
|
|
|
# BMail
|
|
|
|
|
|
|
|
The BMail package allows you to send email templates on Laravel to the Bluescale API.
|
|
|
|
|
2020-04-09 17:57:21 +02:00
|
|
|
## Installation
|
2020-04-09 12:55:07 +02:00
|
|
|
|
2020-04-09 17:43:19 +02:00
|
|
|
First in your composer.json, add :
|
2020-04-09 12:55:07 +02:00
|
|
|
|
|
|
|
```bash
|
2020-04-09 16:00:19 +02:00
|
|
|
"require": {
|
|
|
|
"bluescale/laravel-bmail": "dev-master"
|
2020-04-09 12:55:07 +02:00
|
|
|
}
|
2020-04-09 17:29:07 +02:00
|
|
|
```
|
2020-04-09 16:00:19 +02:00
|
|
|
|
|
|
|
and
|
|
|
|
|
|
|
|
```bash
|
|
|
|
"repositories": [
|
|
|
|
{
|
|
|
|
"type": "vcs",
|
|
|
|
"url": "git@git.bluesquare.io:bluescale/laravel-bmail.git"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
2020-04-09 17:43:19 +02:00
|
|
|
Next update your package :
|
2020-04-09 16:00:19 +02:00
|
|
|
|
|
|
|
```bash
|
2020-04-09 17:43:19 +02:00
|
|
|
composer update bluescale/laravel-bmail
|
2020-04-09 12:55:07 +02:00
|
|
|
```
|
2020-04-09 17:21:16 +02:00
|
|
|
|
2020-04-09 17:43:19 +02:00
|
|
|
Then publish the assets from your provider :
|
2020-04-09 17:21:16 +02:00
|
|
|
|
|
|
|
```bash
|
|
|
|
php artisan vendor:publish
|
|
|
|
```
|
|
|
|
|
2020-04-09 17:43:19 +02:00
|
|
|
Finally add your API key in the .env :
|
|
|
|
|
|
|
|
```bash
|
|
|
|
BMAIL_API_KEY=your_key
|
|
|
|
BMAIL_API_URL=the_api_url
|
|
|
|
```
|
|
|
|
|
2020-04-09 17:57:21 +02:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$template = (new BMailTemplate("** template_id **"))
|
|
|
|
->sender("john.doe@gmail.com", 'John')
|
|
|
|
->replyTo("jean.grey@gmail.com", 'Jean')
|
|
|
|
->recipients([
|
|
|
|
['elvis@gmail.com', ['name' => 'Elvis']],
|
|
|
|
['matthew@gmail.com', ['name' => 'Matthew', 'parameters' => ['key' => 'value']]
|
|
|
|
])
|
|
|
|
->addRecipient('edward@gmail.com')
|
|
|
|
->addRecipient("robert@gmail.com", ['name' => 'Rob', 'parameters' => ['key' => 'value']])
|
|
|
|
->parameters(['foo' => 'bar', 'foo' => 'fighter'])
|
|
|
|
->addParameter('key', 'value');
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
return (new BMailApi(config('bmail.api_key')))->send($template);
|
|
|
|
```
|
|
|
|
|
2020-04-09 17:21:16 +02:00
|
|
|
|