PHP code example of bsadnu / yii2-mailgunmailer

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

    

bsadnu / yii2-mailgunmailer example snippets


'components' => [
    ...
    'mailer' => [
        'class' => 'bsadnu\mailgunmailer\Mailer',
        'key' => 'MailGun API Key',
        'domain' => 'domain.name',
    ],
    ...
],

Yii::$app
    ->mailer
    ->compose(
        ['html' => 'someTemplate-html', 'text' => 'someTemplate-text'],
        ['someVariable' => $someVariable]
    )
    ->setFrom('[email protected]')
    ->setTo('[email protected]')
    ->setSubject('Some subject')
    ->send();

php composer.phar