Mailgun
Mailgun integration for the Yii framework, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist boundstate/yii2-mailgun "*"
or add, (*4)
"boundstate/yii2-mailgun": "*"
to the require section of your composer.json file., (*5)
Usage
Configure it in the application configuration:, (*6)
'components' => [
    ...
    'mailer' => [
        'class' => 'boundstate\mailgun\Mailer',
        'key' => 'key-example',
        'domain' => 'mg.example.com',
    ],
    ...
],
To send an email, you may use the following code:, (*7)
Yii::$app->mailer->compose('contact/html', ['contactForm' => $form])
    ->setFrom('from@domain.com')
    ->setTo($form->email)
    ->setSubject($form->subject)
    ->send();