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-10 13:11:40 +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-10 13:11:40 +02:00
|
|
|
]
|
2020-04-09 16:00:19 +02:00
|
|
|
```
|
|
|
|
|
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 **"))
|
2020-04-10 13:13:13 +02:00
|
|
|
->sender("john.doe@gmail.com", "John OPTIONNAL") OPTIONNAL
|
|
|
|
->replyTo("jean.grey@gmail.com", "Jean OPTIONNAL") OPTIONNAL
|
2020-04-09 17:57:21 +02:00
|
|
|
->recipients([
|
2020-04-10 13:10:48 +02:00
|
|
|
[
|
2020-04-10 13:13:13 +02:00
|
|
|
"elvis@gmail.com", [
|
|
|
|
"name" => "Elvis" OPTIONNAL,
|
|
|
|
"parameters" => ["key" => "value"] OPTIONNAL
|
2020-04-10 13:10:48 +02:00
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
2020-04-10 13:13:13 +02:00
|
|
|
"robert@gmail.com"
|
2020-04-10 13:10:48 +02:00
|
|
|
]
|
2020-04-09 17:57:21 +02:00
|
|
|
])
|
2020-04-10 13:13:13 +02:00
|
|
|
->addRecipient("edward@gmail.com")
|
2020-04-14 17:24:54 +02:00
|
|
|
->parameters(["key" => "value", "key" => "value"])
|
2020-04-10 13:13:13 +02:00
|
|
|
->addParameter("key", "value");
|
2020-04-09 17:57:21 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
2020-04-10 13:13:13 +02:00
|
|
|
return (new BMailApi(config("bmail.api_key")))->send($template);
|
2020-04-09 17:57:21 +02:00
|
|
|
```
|
|
|
|
|
2020-04-09 17:21:16 +02:00
|
|
|
|