laravel-mail/README.md

1.3 KiB

BMail

The BMail package allows you to send email templates on Laravel to the Bluescale API.

Installation

First in your composer.json, add :

"require": {
        "bluescale/laravel-bmail": "dev-master"
}

and

"repositories": [
        {
            "type": "vcs",
            "url": "git@git.bluesquare.io:bluescale/laravel-bmail.git"
        }
]

Next update your package :

composer update bluescale/laravel-bmail

Then publish the assets from your provider :

php artisan vendor:publish

Finally add your API key in the .env :

BMAIL_API_KEY=your_key
BMAIL_API_URL=the_api_url

Usage

$template = (new BMailTemplate("** template_id **"))
    ->sender("john.doe@gmail.com", "John OPTIONNAL") OPTIONNAL
    ->replyTo("jean.grey@gmail.com", "Jean OPTIONNAL") OPTIONNAL
    ->recipients([
        [
            "elvis@gmail.com", [
                "name" => "Elvis" OPTIONNAL,
                "parameters" => ["key" => "value"] OPTIONNAL
            ]
        ],
        [
            "robert@gmail.com"
        ]
    ])
    ->addRecipient("edward@gmail.com")
    ->parameters(["key" => "value", "key" => "value"])
    ->addParameter("key", "value");
return (new BMailApi(config("bmail.api_key")))->send($template);