-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from simialbi/master
Extended Message properties like non global merge vars, metadata, analytics
- Loading branch information
Showing
7 changed files
with
485 additions
and
2,865 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,33 @@ | ||
/tests/runtime/ | ||
/vendor/ | ||
tests/_support/_generated | ||
# phpstorm project files | ||
.idea | ||
|
||
# netbeans project files | ||
nbproject | ||
|
||
# zend studio for eclipse project files | ||
.buildpath | ||
.project | ||
.settings | ||
|
||
# windows thumbnail cache | ||
Thumbs.db | ||
|
||
# composer vendor dir | ||
/vendor | ||
|
||
# composer itself is not needed and related files | ||
composer.phar | ||
composer.lock | ||
|
||
# Mac DS_Store Files | ||
.DS_Store | ||
|
||
# phpunit itself is not needed | ||
phpunit.phar | ||
|
||
# local phpunit config | ||
/phpunit.xml | ||
|
||
# test suite files | ||
tests/runtime/ | ||
tests/_support/_generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,20 +52,22 @@ First of all you will need to add an `application name`. | |
By default this extension will send every single email using the application name as the sender name and the `adminEmail` parameter inside `params.php` as the sender email. | ||
|
||
|
||
``` | ||
'id' => 'basic', | ||
'name' => 'Application Name', | ||
```php | ||
[ | ||
'id' => 'basic', | ||
'name' => 'Application Name', | ||
] | ||
``` | ||
|
||
``` | ||
```php | ||
return [ | ||
'adminEmail' => '[email protected]', | ||
]; | ||
``` | ||
|
||
You will then need to add the component | ||
|
||
``` | ||
```php | ||
'mailer' => [ | ||
'class' => 'nickcv\mandrill\Mailer', | ||
'apikey' => 'YourApiKey', | ||
|
@@ -74,7 +76,7 @@ You will then need to add the component | |
|
||
From now on you can just use the mandrill mailer just as you used to use the default one. | ||
|
||
``` | ||
```php | ||
\Yii::$app->mailer | ||
->compose('mailViewName', ['model' => $model]) | ||
->setTo('[email protected]') | ||
|
@@ -102,7 +104,7 @@ Since **version 1.4.0** the component won't default to the application name and | |
|
||
To override this behavior you can set to false the `useTemplateDefaults` attribute in the component configuration | ||
|
||
``` | ||
```php | ||
'mailer' => [ | ||
'class' => 'nickcv\mandrill\Mailer', | ||
'apikey' => 'YourApiKey', | ||
|
@@ -120,7 +122,7 @@ For more information about handlebars usage check these links: | |
|
||
You can change preferred language by editing `templateLanguage` attribute in the component configuration | ||
|
||
``` | ||
```php | ||
'mailer' => [ | ||
'class' => 'nickcv\mandrill\Mailer', | ||
'apikey' => 'YourApiKey', | ||
|
@@ -135,7 +137,7 @@ Additional Methods | |
|
||
Mandrill lets you set up tags. The method `\nickcv\mandrill\Message::setTags($tags)` accept as an argument both a string or an array of strings: | ||
|
||
``` | ||
```php | ||
\Yii::$app->mailer | ||
->compose('mailViewName', ['model' => $model]) | ||
->setTags(['registration']); | ||
|
@@ -146,7 +148,7 @@ When using async mode mandrill will queue the messages and send em in batches. | |
If you send a message to more than 10 email addresses async mode will be used | ||
automatically. | ||
|
||
``` | ||
```php | ||
\Yii::$app->mailer | ||
->compose('mailViewName', ['model' => $model]) | ||
->enableAsync(); | ||
|
@@ -164,6 +166,21 @@ Since **version 1.7.0** it's also possible to enable/disable messages clicks/ope | |
|
||
It is also possible to retrieve the full body of the response returned from Mandrill using the `Mailer::getLastTransaction` method. | ||
|
||
|
||
**Sending Multiple Email with Mandril Template using merge_vars** | ||
|
||
You can consider using this method for using mandrill template and change the variable based on your data : | ||
|
||
```php | ||
\Yii::$app->mailer | ||
->compose($stringTemplate) | ||
->setTo($arrayTo) | ||
->setGlobalMergeVars($arrayGolbalMergeVars) | ||
->setMergeVars($arrayMergeVars) | ||
->send(); | ||
``` | ||
|
||
|
||
Unit Testing | ||
------------ | ||
|
||
|
@@ -181,4 +198,4 @@ The component automatically logs every single message sent through mandrill, ins | |
|
||
Messages sent successfully are logged using `\Yii::info()`, messages rejected or invalid are logged using `\Yii::warning()`, and all the exceptions thrown by the Mandrill Class are logged using `\Yii::error()`. | ||
|
||
If you are using mandrill templates and the template is not found the error will be logged using `Yii::info()`. | ||
If you are using mandrill templates and the template is not found the error will be logged using `Yii::info()`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,43 @@ | ||
{ | ||
"name": "nickcv/yii2-mandrill", | ||
"description": "Mandrill Api Integration for Yii2", | ||
"type": "yii2-extension", | ||
"keywords": ["yii2", "extension", "mandrill", "mailer", "email"], | ||
"license": "GPL-3.0", | ||
"authors": [ | ||
{ | ||
"name": "Nicola Puddu", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"yiisoft/yii2": "*", | ||
"mandrill/mandrill": "*" | ||
"name": "nickcv/yii2-mandrill", | ||
"description": "Mandrill Api Integration for Yii2", | ||
"type": "yii2-extension", | ||
"keywords": [ | ||
"yii2", | ||
"extension", | ||
"mandrill", | ||
"mailer", | ||
"email" | ||
], | ||
"license": "GPL-3.0", | ||
"authors": [ | ||
{ | ||
"name": "Nicola Puddu", | ||
"email": "[email protected]" | ||
}, | ||
"require-dev": { | ||
"codeception/codeception": "*", | ||
"victorjonsson/markdowndocs": "*", | ||
"yiisoft/yii2-coding-standards": "~2.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"nickcv\\mandrill\\": "src/" | ||
} | ||
{ | ||
"name": "Simon Karlen", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"repositories": [ | ||
{ | ||
"type": "composer", | ||
"url": "https://asset-packagist.org" | ||
} | ||
], | ||
"require": { | ||
"yiisoft/yii2": "~2.0", | ||
"mandrill/mandrill": "~1.0" | ||
}, | ||
"require-dev": { | ||
"codeception/codeception": "*", | ||
"victorjonsson/markdowndocs": "*", | ||
"yiisoft/yii2-coding-standards": "~2.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"nickcv\\mandrill\\": "src/" | ||
} | ||
} | ||
} |
Oops, something went wrong.