Extension for creating and sending emails for the Yii PHP framework.

Overview

yii-emailer

Extension for creating and sending emails for the Yii PHP framework.

Usage

  • Migrate the email_message database table by this command:

yiic migrate --migrationPath=vendor.nordsoftware.yii-emailer.migrations

  • Attach the EmailBehavior to your controller or to any component that you want to use this extention on it:
public function behaviors()
    {
        return array_merge(parent::behaviors(), array(
            'emailer' => array(
                'class' => 'EmailBehavior',
            ),
        ));
    }
  • Add Emailer component to your app config:
return array(
'components' => array(
        'email' => array(
            'class' => 'vendor.nordsoftware.yii-emailer.components.Emailer'
        )
    ));
  • Now you can send the message by calling:
$email = $this->createEmail($from, $to, $subject, $body, array('body'=>$message));
$this->sendEmail($email);
  • To use templates you need to define them in your app config:
    'templates'=>array(
      'foo'=>array(
       'subject'=>'Foo',
       'view'=>'foo', // refers to a view in views/email
      ),
    ),
You might also like...
Geography module for Yii 2

Geography module for Yii 2

Code generation with logic-less templates for Yii

Caviar Code generation with logic-less templates for Yii. Caviar vs Gii You might be wondering why you should use Caviar instead of Gii, so let us tak

Extends Yii Menu widget

Extends Yii Menu widget. This widget offers a scrollspy and affixed enhanced navigation (upto 2-levels) to highlight sections and secondary sections in each page.

DepDrop widget is a Yii 2 wrapper for the dependent-dropdown jQuery plugin by Krajee.

yii2-widget-depdrop The DepDrop widget is a Yii 2 wrapper for the dependent-dropdown jQuery plugin by Krajee. This plugin allows multi level dependent

An enhanced Yii 2 widget encapsulating the HTML 5 range input (sub repo split from yii2-widgets)
An enhanced Yii 2 widget encapsulating the HTML 5 range input (sub repo split from yii2-widgets)

yii2-widget-rangeinput The RangeInput widget is a customized range slider control widget based on HTML5 range input. The widget enhances the default H

Password strategies for Yii

Password strategies are specifications for how passwords should be encoded and verified and how complicated user supplied passwords should be.

Pods is a development framework for creating, extending, managing, and deploying customized content types in WordPress.

Pods Framework Pods is a development framework for creating, extending, managing, and deploying customized content types in WordPress. Description Che

LODSPeaKr is a framework for creating Linked Data applications in a simple and easy way

LODSPeaKr is a framework for creating Linked Data applications in a simple and easy way. You can see several applications created using LODSPeaKr.

Fast php framework written in c, built in php extension

Yaf - Yet Another Framework PHP framework written in c and built as a PHP extension. Requirement PHP 7.0+ (master branch)) PHP 5.2+ (php5 branch) Inst

Comments
  • require stable versions in composer.json

    require stable versions in composer.json

    These two are only available with stability dev in your root package, would be nice if you could create at least a 0.1 tag for them.

    "nordsoftware/yii-utils": "dev-master",
    "crisu83/yii-formatter": "dev-master"
    
    opened by schmunk42 4
  • Undefined t() function

    Undefined t() function

    https://github.com/nordsoftware/yii-emailer/blob/master/controllers/EmailController.php#L38 I'm not sure, but seem to be a typo here, must be Yii::t() Am I right?

    opened by Borales 2
  • Pass data to view issue

    Pass data to view issue

    Cant pass in current implementation objects/arrays (any differs from string) to view through the $data array in method createMessage, because of this error: Object of class ... could not be converted to string. It occurs at this line: https://github.com/nordsoftware/yii-emailer/blob/master/components/Emailer.php#L136 So i think this replacement can be removed because of it is only needed for pageTitle and looks like strange feature.

    opened by Ragazzo 1
  • EmailMessage AR undefined field.

    EmailMessage AR undefined field.

    When sending email got that error: Property "EmailMessage.sentTime" is not defined.. So should this property must be added as public or maybe it is some error and it must be created AR attribute?

    problem is here in send() method

    $model->sentTime = date('Y-m-d H:i:s');
    

    P.S. for now, for myself i simple added

    public $sentTime;
    

    to EmailMessage AR, but i think that this must be added to the table, because of needed info. also must be sent_time i think.

    opened by Ragazzo 1
Owner
Digia
We share the passion for writing great code.
Digia
This extension provides a view renderer for Pug templates for Yii framework 2.0 applications.

This extension provides a view renderer for Pug templates for Yii framework 2.0 applications.

Revin Roman 9 Jun 17, 2022
This extension provides Flysystem integration for the Yii framework

This extension provides Flysystem integration for the Yii framework. Flysystem is a filesystem abstraction which allows you to easily swap out a local filesystem for a remote one.

Alexander Kochetov 276 Dec 9, 2022
Yii 2 Bootstrap 5 Extension

Twitter Bootstrap 5 Extension for Yii 2 This is the Twitter Bootstrap extension for Yii framework 2.0. It encapsulates Bootstrap 5 components and plug

Yii Software 48 Dec 14, 2022
Yii2-symfonymailer - Yii 2 Symfony mailer extension.

Yii Mailer Library - Symfony Mailer Extension This extension provides a Symfony Mailer mail solution for Yii framework 2.0. For license information ch

Yii Software 28 Dec 22, 2022
Yii 2: The Fast, Secure and Professional PHP Framework

Yii 2 is a modern framework designed to be a solid foundation for your PHP application. It is fast, secure and efficient and works right out of the bo

Yii Software 14k Dec 31, 2022
Implementing programming best practices and patterns, and creating a custom PHP framework from scratch.

Implementing programming best practices and patterns, and creating a custom PHP framework from scratch.

Sajidur Rahman 3 Jul 2, 2022
Mind is the PHP code framework designed for developers. It offers a variety of solutions for creating design patterns, applications and code frameworks.

Mind Mind is the PHP code framework designed for developers. It offers a variety of solutions for creating design patterns, applications and code fram

null 0 Dec 13, 2021
Opulence is a PHP web application framework that simplifies the difficult parts of creating and maintaining a secure, scalable website.

Opulence Introduction Opulence is a PHP web application framework that simplifies the difficult parts of creating and maintaining a secure, scalable w

Opulence 733 Sep 8, 2022
Yii-specific middleware

Yii Middleware The package ... Requirements PHP 8.0 or higher. Installation The package could be installed with composer: composer require yiisoft/yii

Yii Software 9 Nov 4, 2022
Yii 2 widget for the Froala WYSIWYG HTML Editor.

Yii Framework Froala WYSIWYG HTML Editor Yii 2 widget for Froala Wysiwyg editor. Installation The preferred way to install this extension is through c

Froala 99 Sep 21, 2022