PHP code example of ashraful19 / laravel-mailbridge

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

    

ashraful19 / laravel-mailbridge example snippets


'providers' => [
    'postmark' => [
        'server_token' => env('POSTMARK_SERVER_TOKEN'),
        'from' => [
            'address' => env('POSTMARK_FROM_ADDRESS'),
            'name' => env('POSTMARK_FROM_NAME'),
        ],
    ],
],

Mail::to($user)->send(new WelcomeMail($user));

MailBridge::transactional()
    ->to($user->email, $user->name)
    ->send(new WelcomeMail($user));

MailBridge::transactional()
    ->template('welcome')
    ->to($user->email)
    ->data(['name' => $user->name])
    ->send();

MailBridge::transactional()
    ->template('welcome')
    ->to($user->email)
    ->data(['name' => $user->name])
    ->dataFor('brevo', ['FIRSTNAME' => $user->name])
    ->dataFor('postmark', ['name' => $user->name])
    ->send();

MailBridge::transactional('postmark')
    ->withFallback(false)
    ->to($user->email)
    ->subject('Welcome')
    ->text('Hello')
    ->send();

use Ashraful19\LaravelMailbridge\Data\Subscriber;

MailBridge::marketing()
    ->list('signup')
    ->subscribe(Subscriber::make($user->email)->name($user->name));

use Ashraful19\LaravelMailbridge\Data\Campaign;

MailBridge::marketing()
    ->list('signup')
    ->unsubscribe($user->email);

$subscriber = MailBridge::marketing()->getSubscriber($user->email);

$campaign = MailBridge::marketing()
    ->createCampaign(
        Campaign::make('Product Launch')
            ->subject('New release is live')
            ->html('<h1>Launch</h1>')
            ->list('signup')
    );

$result = MailBridge::transactional()
    ->to($user->email)
    ->subject('Welcome')
    ->text('Hello')
    ->send();

$result->provider;  // string, selected provider name
$result->messageId; // ?string, provider message id when available
$result->metadata;  // array, provider-specific extra data

$result = MailBridge::marketing()
    ->list('signup')
    ->subscribe(Subscriber::make($user->email));

$result->provider;  // string
$result->operation; // string, e.g. subscribe, campaign_create
$result->metadata;  // array, provider-specific fields

$record = MailBridge::marketing()->getSubscriber($user->email);

// null when subscriber not found
$record?->provider; // string
$record?->email;    // string
$record?->data;     // array, provider-native payload
bash
composer vendor:publish --tag=mailbridge-config
php artisan mailbridge:install
bash
php artisan mailbridge:doctor
bash
php artisan mailbridge:verify --provider=brevo [email protected] --cleanup