PHP code example of devkea / laravel-mandrill-driver

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

    

devkea / laravel-mandrill-driver example snippets


public function via($notifiable)
{
    return [MandrillChannel::class];
}

public function toMandrill($notifiable)
{
    return (new MandrillMessage())
        ->subject('Purchase successful')
        ->addTo($notifiable->email)
        ->view('mandrill-template-name', [
            'product' => $this->product->toArray(),
            'user' => [
                'name' => $notifiable->name,
                'phone' => $notifiable->phone
            ]
        ]);
}

public function toMandrill($notifiable)
{
    return (new MandrillMessage())
        ->subject('Purchase successful')
        ->templateName('mandrill-template-name')
        ->addTo($notifiable->email)
        ->addTos(['[email protected]', '[email protected]'])
        ->fromName('Customized From')
        ->fromEmail('[email protected]')
        ->replyTo('[email protected]')
        ->attach($notifiable->file)
        ->content([
            'product' => $this->product->toArray(),
        ]);
}

public function toMandrill($notifiable)
{
    return (new MandrillMessage())
        ->subject('Purchase successful')
        ->templateName('mandrill-template-name', 'mailchimp') << HERE
        ->addTo($notifiable->email)
        ->content([
            'customer_name' => $notifiable->name,
            'invoice_link' => 'http://example.com/download/invoice.pdf',
        ])
}