PHP code example of danielkellyio / mailgun-mailable

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

    

danielkellyio / mailgun-mailable example snippets



use DanielKellyIO\MailgunMailable\MailgunMailable;
// ...

class YourEmail extends Mailable {
	use MailgunMailable;

	public function build() {
		$this->tags(['tag-1', 'tag-2']);
		// ...
	}
}


use DanielKellyIO\MailgunMailable\MailgunMailable;
// ...

class YourEmail extends Mailable {
	use MailgunMailable;

	public function build() {
        $this->variables([
            'greeting' => 'Hello',
            'name' => 'Daniel'
        ]);
		// ...
	}
}

use DanielKellyIO\MailgunMailable\MailgunHelpers;

Mail::send( 'your-email-template', [], function ( $m ) {
    $m->to( '[email protected]' )->subject( 'Test Email' );
    MailgunHelpers::tags($m, ['tag-1', 'tag-2']);
    MailgunHelpers::variables($m, [
        'greeting' => 'Hello',
        'name' => 'Daniel'
    ]);
});