apriside/yii2-mailgun-mailer

Mailgun Mailer for Yii 2 framework.

Installs: 5 064

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 22

Type:yii2-extension

1.6 2019-10-26 21:40 UTC

This package is auto-updated.

Last update: 2024-03-27 20:51:26 UTC


README

Mailgun mailer for Yii 2 framework.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist e96/yii2-mailgun-mailer "*"

or add

"e96/yii2-mailgun-mailer": "*"

to the require section of your composer.json file.

Usage

First, update your mailer config like so:

'mailer' => [
  'class' => 'e96\mailgunmailer\Mailer',
  'domain' => 'domain.com',
  'key' => 'api-key',
  'tags' => ['yii'],
  'clickTracking' => false,
  'opensTracking' => false
],

Yii's mailer will now use the Mailgun configuration, so send mail like normal:

<?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();
?>```