Yii2 Mailgun Mailer
Mailgun mailer for Yii 2 framework., (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist farmani/yii2mailgunmailer "*"
or add, (*4)
"farmani/yii2mailgunmailer": "*"
to the require section of your composer.json
file., (*5)
Config
php
'components' => [
...
'mailer' => [
'class' => 'farmani\yii2mailgunmailer\Mailer',
'domain' => 'example.com',
'key' => 'key-somekey',
'tags' => ['yii'],
'enableTracking' => false,
],
...
],
?>
, (*6)
Usage
Once the extension is installed, simply use it in your code by :, (*7)
php
<?php
Yii::$app->mailer->compose('<view_name>', <option>)
->setFrom("<from email>")
->setTo("<to email>")
->setSubject("<subject>")
// ->setHtmlBody("<b> Hello User </b>")
// ->setTextBody("Hello User")
->send();
?>
, (*8)