itbeauftragter/yii2-nsl-mailgun

NSL Mailgun Extension for Yii2

1.0.5 2019-12-19 11:45 UTC

This package is auto-updated.

Last update: 2024-12-19 23:08:48 UTC


README

NSL Mailgun Extension for Yii2

Version

Aktuelle Version: 1.0.5

Installation

php composer.phar require --prefer-dist itbeauftragter/yii2-nsl-mailgun "*"

Usage

Configure it in the application configuration:

'components' => [
    ...
    'mailer' => [
        'class' => 'itbeauftragter\mailgun\Mailer',
        'key' => 'key-example',
        'domain' => 'mg.example.com',
        'endpoint' => 'api.eu.mailgun.net'
    ],
    ...
],

To send an email, you may use the following code:

Yii::$app->mailer->compose('contact/html', ['contactForm' => $form])
    ->setFrom('from@domain.com')
    ->setTo($form->email)
    ->addTags(['Tag1', 'Tag2'])
    ->setSubject($form->subject)
    ->send();