newsletter Creating & sending dynamic email template for different events like REGISTRATION, FORGOT PASSWORD, etc.

  1. Purpose
  2. Benefits
  3. Requirements
  4. Installation
  5. Usage

Purpose

  • As we all use email templates into website; here's the best solution which we all can try and can have easy outcomes.
  • It would provide a feel of using CMS.
  • This module is used for creating a dynamic email template for different events like REGISTRATION, FORGOT PASSWORD, LOGIN, etc.
  • If there are any changes into template's content then website Admin have to goto the developer to change the content. By using this website Admin can manage the content by themselves.
  • Newsletter template also have a Active-Inactive facility for enable or disable template.

Benefits

  • Non technical users can also use it.
  • Reduces production time.

Requirements

  • Yii 1.1

Installation

1) Download file and unzip it into protected/modules.

2) In config/main.php

'modules'=>array(
		'newsletter' =>array(
			'components' => array(
				'tools' => array(
        			'class'=>'ToolsComponent',
       			 ),
			)
		),
),

3) Go to the protected directory of your project and run this command in terminal:-

$ php yiic migrate --migrationPath=application.modules.newsletter.migrations
                                     OR
$ yiic migrate --migrationPath=application.modules.newsletter.migrations

Usage

1) Add this code for menu in views/layouts/main.php :- In items array,

<?php
      array('url'=>array('/newsletter/eventNewsletterTemplate/index'), 'label'=>'EventNewsletter'),
      array('url'=>array('/newsletter/newsletterTemplate/index'), 'label'=>'Newsletter'),
      array('url'=>array('/newsletter/eventTemplate/index'), 'label'=>'Event'),
?>

2) Write the below code where you want to send an email :- In Controller,

<?php 
  // arrParams array contains eventtype same as the event_template table event type
  // repacement array used for variables which you want to replace dynamically from your content

	 $arrParams = array( 'eventtype' => 'FORGOT_PASSWORD',
		                  'replacement' => array(
					             '##USEREMAIL##' => 'testUser@gmail.com',
		                         '##USERNAME##' => 'testUser',
					              -------
		                       ));
	 $emaildetails = Yii::app()->getModule('newsletter')->tools->getdetails($arrParams); //call global function getdetails() of the components/ToolsComponent.php
				    			
	 if(!empty($emaildetails)) {
		  $subject = $emaildetails['subject'];
		  $message = $emaildetails['view'];
		  $user = 'testUser@gmail.com';				   
	 }
	 else {
	     //put your default code of the email parameters
	 } 
?>

Hey guys, please feel free to revert back with any feedback or queries. Suggestions are always welcomed!!!

0 0
1 follower
213 downloads
Yii Version: 1.1
License: MIT
Category: Mail
Developed by: Saurabh Dhariwal
Created on: Jan 11, 2016
Last updated: 8 years ago

Downloads

show all

Related Extensions