Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pgaultier/yii2-mailjet
Yii2 Mailjet integration
https://github.com/pgaultier/yii2-mailjet
Last synced: 2 months ago
JSON representation
Yii2 Mailjet integration
- Host: GitHub
- URL: https://github.com/pgaultier/yii2-mailjet
- Owner: pgaultier
- License: other
- Created: 2017-09-25T17:44:33.000Z (over 7 years ago)
- Default Branch: devel
- Last Pushed: 2018-09-04T16:10:16.000Z (over 6 years ago)
- Last Synced: 2024-10-11T20:23:57.846Z (3 months ago)
- Language: PHP
- Size: 35.2 KB
- Stars: 1
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
Mailjet Yii2 integration
=========================This extension allow the developper to use [Mailjet](https://www.mailjet.com/) as an email transport.
[![Latest Stable Version](https://poser.pugx.org/sweelix/yii2-mailjet/v/stable)](https://packagist.org/packages/sweelix/yii2-mailjet)
[![Build Status](https://api.travis-ci.org/pgaultier/yii2-mailjet.svg?branch=master)](https://travis-ci.org/pgaultier/yii2-mailjet)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pgaultier/yii2-mailjet/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pgaultier/yii2-mailjet/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/pgaultier/yii2-mailjet/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/pgaultier/yii2-mailjet/?branch=master)
[![License](https://poser.pugx.org/sweelix/yii2-mailjet/license)](https://packagist.org/packages/sweelix/yii2-mailjet)[![Latest Development Version](https://img.shields.io/badge/unstable-devel-yellowgreen.svg)](https://packagist.org/packages/sweelix/yii2-mailjet)
[![Build Status](https://travis-ci.org/pgaultier/yii2-mailjet.svg?branch=devel)](https://travis-ci.org/pgaultier/yii2-mailjet)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pgaultier/yii2-mailjet/badges/quality-score.png?b=devel)](https://scrutinizer-ci.com/g/pgaultier/yii2-mailjet/?branch=devel)
[![Code Coverage](https://scrutinizer-ci.com/g/pgaultier/yii2-mailjet/badges/coverage.png?b=devel)](https://scrutinizer-ci.com/g/pgaultier/yii2-mailjet/?branch=devel)Installation
------------If you use Packagist for installing packages, then you can update your composer.json like this :
``` json
{
"require": {
"sweelix/yii2-mailjet": "*"
}
}
```Howto use it
------------Add extension to your configuration
``` php
return [
//....
'components' => [
'mailer' => [
'class' => 'sweelix\mailjet\Mailer',
'token' => '',
],
],
];
```You can send email as follow (using mailjet templates)
``` php
Yii::$app->mailer->compose('contact/html')
->setFrom('[email protected]')
->setTo($form->email)
->setSubject($form->subject)
->setTemplateId(12345)
->setTemplateModel([
'firstname' => $form->firstname,
'lastname' => $form->lastname,
->send();```
For further instructions refer to the [related section in the Yii Definitive Guide](http://www.yiiframework.com/doc-2.0/guide-tutorial-mailing.html)
Running the tests
-----------------Before running the tests, you should edit the file tests/_bootstrap.php and change the defines :
``` php
// ...
define('MAILJET_FROM', '');
define('MAILJET_KEY', '');
define('MAILJET_SECRET', '');
define('MAILJET_TO', '');
define('MAILJET_TEMPLATE', 218932);define('MAILJET_TEST_SEND', false);
// ...```
to match your [Mailjet](https://www.mailjet.com/) configuration.
Contributing
------------All code contributions - including those of people having commit access -
must go through a pull request and approved by a core developer before being
merged. This is to ensure proper review of all the code.Fork the project, create a [feature branch ](http://nvie.com/posts/a-successful-git-branching-model/), and send us a pull request.