Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pgaultier/yii2-postmark

Yii2 Postmark integration
https://github.com/pgaultier/yii2-postmark

mailer postmarkapp yii2

Last synced: 17 days ago
JSON representation

Yii2 Postmark integration

Awesome Lists containing this project

README

        

Postmark Yii2 integration
=========================

This extension allow the developper to use [PostmarkApp](https://postmarkapp.com/) as an email transport.

[![Latest Stable Version](https://poser.pugx.org/sweelix/yii2-postmark/v/stable)](https://packagist.org/packages/sweelix/yii2-postmark)
[![Build Status](https://api.travis-ci.org/pgaultier/yii2-postmark.svg?branch=master)](https://travis-ci.org/pgaultier/yii2-postmark)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/?branch=master)
[![License](https://poser.pugx.org/sweelix/yii2-postmark/license)](https://packagist.org/packages/sweelix/yii2-postmark)

[![Latest Development Version](https://img.shields.io/badge/unstable-devel-yellowgreen.svg)](https://packagist.org/packages/sweelix/yii2-postmark)
[![Build Status](https://travis-ci.org/pgaultier/yii2-postmark.svg?branch=devel)](https://travis-ci.org/pgaultier/yii2-postmark)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/badges/quality-score.png?b=devel)](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/?branch=devel)
[![Code Coverage](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/badges/coverage.png?b=devel)](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/?branch=devel)

Installation
------------

If you use Packagist for installing packages, then you can update your composer.json like this :

``` json
{
"require": {
"sweelix/yii2-postmark": "*"
}
}
```

Howto use it
------------

Add extension to your configuration

``` php
return [
//....
'components' => [
'mailer' => [
'class' => 'sweelix\postmark\Mailer',
'token' => '',
],
],
];
```

You can send email as follow (using postmark 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('POSTMARK_FROM', '');
define('POSTMARK_TOKEN', '');
define('POSTMARK_TO', '');
define('POSTMARK_TEMPLATE', 575741);

define('POSTMARK_TEST_SEND', false);
// ...

```

to match your [PostmarkApp](https://postmarkapp.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.