tusharug / yii2-mail-templates
Create and Edit mail templates
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-06-25 08:24:54 UTC
README
Create and Edit mail templates
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist tusharug/yii2-mail-templates "*"
or add
"tusharug/yii2-mail-templates": "*"
to the require section of your composer.json
file.
Usage
Add mailtemplates to modules in web.php
$config['modules']['mailtemplates'] = [ 'class' => 'tusharug\mailtemplates\Template', ];
Create tables by running following migration command
php yii migrate --migrationPath=@vendor/tusharug/yii2-mail-templates/migrations/
Send Mail using Template
use tusharug\mailtemplates\components\MailTemplateManager; $data = array( 'key1'=>'Value1', 'key2'=>'Value2', 'key3'=>'Value3', ); $template = new MailTemplateManager(); $template->setTemplate('template_code', $data);
Get Subject
$template->getSubject();
Get Body
$template->getBody();
You should manage access of following links.
Developer / Admin Link - Will be used to create, update, delete Templates
http://www.yourapp.com/index.php?r=mailtemplates
End User Link -Will be used only for editing templates.
http://www.yourapp.com/index.php?r=mailtemplates/user