2017 © Pedro Peláez
 

library mt-mail

Zend Framework e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

image

mtymek/mt-mail

Zend Framework e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  • Wednesday, November 15, 2017
  • by mtymek
  • Repository
  • 6 Watchers
  • 21 Stars
  • 18,607 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 14 Forks
  • 3 Open issues
  • 18 Versions
  • 6 % Grown

The README.md

E-mail module for Zend Framework

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads, (*1)

Introduction

MtMail handles common activities surrounding sending e-mail from applications, mainly creating messages from templates, and sending them through transport adapters., (*2)

Features:

  • factory for creating e-mail messages
  • factory for e-mail transport adapters, service for one-line dispatch
  • rendering templates from phtml files, using Zend\View and PhpRenderer
  • rendering templates with layouts
  • plugins for various common tasks: from setting default headers to generating plaintext version of HTML message
  • plugin support via dedicated plugin managers

Installation

Installation is supported via Composer:, (*3)

$ composer require mtymek/mt-mail

Creating e-mails

Configuration

By default MtMail doesn't require any extra configuration. It will use Zend\View to render templates accessible by your application., (*4)

Usage

Creating message from controller:, (*5)

$mailService = $this->getServiceLocator()->get(\MtMail\Service\Mail::class);

$headers = [
    'to' => 'johndoe@domain.com',
    'from' => 'contact@mywebsite.com',
];
$variables = [
    'userName' => 'John Doe',
];
$message = $mailService->compose($headers, 'application/mail/welcome.phtml', $variables);

This snippet will create a message, compose it with $headers and HTML body rendered from welcome.phtml template (injected with $variables array)., (*6)

Layouts

In order to give your e-mails common layout, you have to enable "Layout" plugin and tell it where to look for layout template:, (*7)

return [
    'mt_mail' => [
        'composer_plugins' => [
            'Layout',
        ],
        'layout' => 'application/mail/layout.phtml',
    ],
];

For more info about composing e-mail messages, check [the documentation](doc/Composing messages.md). You can also check [documentation for plugins](doc/Composer Plugins.md)., (*8)

Sending e-mails

Configuration

Update your application config:, (*9)

return [
    'mt_mail' => [
        'transport' => \Zend\Mail\Transport\Smtp::class,
        'transport_options' => [
            'host' => 'some-host.com',
            'connection_class' => 'login',
            'connection_config' => [
                'username' => 'user',
                'password' => 'pass',
                'ssl' => 'tls',
            ],
        ],
    ],
];

### Usage

Add following code to your controller:, (*10)

// create and configure message
$message = new Message();
$message->addTo('johndoe@domain.com');
// ...

// send!
$mailService = $this->getServiceLocator()->get(\MtMail\Service\Mail::class);
$mailService->send($message);

For more info on sending e-mails, check [the documentation](doc/Sending messages.md)., (*11)

The Versions

15/11 2017
15/11 2017

dev-php_72_support

dev-php_72_support

Zend Framework e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

28/05 2017

dev-release-1.5

dev-release-1.5

Zend Framework e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

21/03 2017

dev-develop

dev-develop

Zend Framework e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

21/03 2017

1.4.0

1.4.0.0

Zend Framework e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

21/03 2017

dev-release

dev-release

Zend Framework e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

21/03 2017

dev-php5.5-compat

dev-php5.5-compat

ZF2 e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

10/03 2017
13/11 2016
29/08 2016

dev-v3_compat

dev-v3_compat

ZF2 e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

11/11 2015

1.1.3

1.1.3.0

ZF2 e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

03/11 2015

dev-feature/php7-support

dev-feature/php7-support

ZF2 e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

17/03 2015

1.1.2

1.1.2.0

ZF2 e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

08/08 2014

dev-hotfix/ignore_duplicate_plugins

dev-hotfix/ignore_duplicate_plugins

ZF2 e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

21/06 2014

1.1.1

1.1.1.0

ZF2 e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template

15/03 2014

1.0.0

1.0.0.0

ZF2 e-mail module. Using this library can easily create e-mail messages from PHTML templates (with optional layouts) and send them using configurable transports. Pluggable, EventManager-driven architecture allows you to customize every aspect of the process.

  Sources   Download

BSD 2-Clause

The Requires

 

The Development Requires

email zf2 module e-mail mail transport mail template