cobyl/ppmodulemailer

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (dev-master) of this package.

PpModuleMailer is a simple ZF2 module that allows you to create mail queue in database.

dev-master 2015-07-15 09:06 UTC

This package is not auto-updated.

Last update: 2020-01-24 14:54:41 UTC


README

Introduction

PpModuleMailer is a simple ZF2 module that allows you to create and send mail queue with sql database.

Installation

Main Setup

With composer

  1. Add this project in your composer.json:

    "require": {
        "cobyl/PpModuleMailer": "dev-master"
    }
  2. Now tell composer to download PpModuleMailer by running the command:

    $ php composer.phar update

Post installation

  1. Enabling it in your application.config.phpfile.

    <?php
    return array(
        'modules' => array(
            // ...
            'PpModuleMailer',
        ),
        // ...
    );
  2. Add table to database.

Please check sql/PpModuleMailer.mysql.sql. This module needs database with enabled transactions.

  1. Copy ppmodulemailer.global.php.dist to config/autoload/ppmodulemailer.global.php

Make any required changes to your configuration.

How to use PpModuleMailer

  1. Adding mail to queue "registration" from controller:

    <?php    
    $mail = new \Zend\Mail\Message();
    $mail->addTo('to@domain.com');
    $mail->addFrom('from@domain.com');
    $mail->setSubject('Subject');
    $mail->setBody('Body');
    $this->getServiceLocator()->get('PpModuleMailer')->add('registration',$mail);
    
  2. or

    <?php
    $this->getServiceLocator()
        ->get('PpModuleMailer')
        ->addMail('registration','to@d.com','Subject','Body','from@d.com');
        
  3. Sending queue "registration" from console:

    $ php public/index.php mailer process registration
    

Configuration

The default configuration is setup to use the system SMTP configuration. For other ways check module.config.php

That's it!