Yii 1.1: newsletter

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

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!!!

Total 2 comments

#19823 report it
Saurabh Dhariwal at 2016/04/04 03:31am
Re: Mailchimp

Yes, This extension provides you template structure for your email content. So, that website admin can change email content according to their need from backend.

#19822 report it
oligalma at 2016/04/03 05:26pm
Mailchimp

Does this extension have integration with mailchimp?

Leave a comment

Please to leave your comment.

Create extension
Downloads