https://github.com/pgaultier/yii2-postmark
Yii2 Postmark integration
https://github.com/pgaultier/yii2-postmark
mailer postmarkapp yii2
Last synced: 7 months ago
JSON representation
Yii2 Postmark integration
- Host: GitHub
- URL: https://github.com/pgaultier/yii2-postmark
- Owner: pgaultier
- License: other
- Created: 2016-04-21T12:33:31.000Z (over 9 years ago)
- Default Branch: devel
- Last Pushed: 2017-07-11T08:02:28.000Z (about 8 years ago)
- Last Synced: 2025-03-17T14:12:55.776Z (7 months ago)
- Topics: mailer, postmarkapp, yii2
- Language: PHP
- Homepage:
- Size: 56.6 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
Postmark Yii2 integration
=========================This extension allow the developper to use [PostmarkApp](https://postmarkapp.com/) as an email transport.
[](https://packagist.org/packages/sweelix/yii2-postmark)
[](https://travis-ci.org/pgaultier/yii2-postmark)
[](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/?branch=master)
[](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/?branch=master)
[](https://packagist.org/packages/sweelix/yii2-postmark)[](https://packagist.org/packages/sweelix/yii2-postmark)
[](https://travis-ci.org/pgaultier/yii2-postmark)
[](https://scrutinizer-ci.com/g/pgaultier/yii2-postmark/?branch=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('from@domain.com')
->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.