PHP code example of mixislv / laravel-mandrill-driver

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

    

mixislv / laravel-mandrill-driver example snippets


'mandrill' => [
    'secret' => env('MANDRILL_SECRET'),
    'webhook-key' => env('MANDRILL_WEBHOOK_KEY'),
],

// @todo

use Symfony\Component\Mime\Email;
 
/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
    $this->view('emails.example');
 
    $this->withSymfonyMessage(function (Email $message) {
        $message->getHeaders()->addTextHeader(
            'Custom-Mailchimp-Header', 'Header Value' // @see https://mailchimp.com/developer/transactional/docs/smtp-integration/#customize-messages-with-smtp-headers

        );
    });
 
    return $this;
}



// @todo

use mixisLv\LaravelMandrillDriver\MandrillWebhookController;

class MandrillController extends MandrillWebhookController {

    /**
     * Handle a hard bounced email
     *
     * @param $payload
     */
    public function handleHardBounce($payload)
    {
        $email = $payload['msg']['email'];
    }

    /**
     * Handle a rejected email
     *
     * @param $payload
     */
    public function handleReject($payload)
    {
        $email = $payload['msg']['email'];
    }
}

Route::post('mandrill-webhook', ['as' => 'mandrill.webhook', 'uses' => 'MandrillController@handleWebHook']);