PHP code example of mail-craft / mailcraft-laravel

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

    

mail-craft / mailcraft-laravel example snippets


Mail::to('[email protected]')->send(new WelcomeEmail($user));

use MailCraft\Laravel\Facades\MailCraft;

MailCraft::contacts()->upsert(email: '[email protected]', firstName: 'Ada');
MailCraft::campaigns()->send($campaignId);

use MailCraft\MailCraft;

class SubscribeController
{
    public function __invoke(MailCraft $mailcraft)
    {
        $mailcraft->contacts->upsert(email: request('email'));
    }
}
bash
php artisan vendor:publish --tag=mailcraft-config