PHPackages                             mtymek/mt-mail - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. mtymek/mt-mail

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

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.

1.5.1(8y ago)1839.2k↓41.7%14[1 issues](https://github.com/mtymek/MtMail/issues)[1 PRs](https://github.com/mtymek/MtMail/pulls)3BSD 2-ClausePHPPHP ^5.5 || ^7.0

Since Mar 15Pushed 7y ago5 watchersCompare

[ Source](https://github.com/mtymek/MtMail)[ Packagist](https://packagist.org/packages/mtymek/mt-mail)[ RSS](/packages/mtymek-mt-mail/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (17)Versions (18)Used By (3)

E-mail module for Zend Framework
================================

[](#e-mail-module-for-zend-framework)

[![Build Status](https://camo.githubusercontent.com/86e5e65ef262ca4536e14cdd6089908f2bff68372accccf623319a74f411200e/68747470733a2f2f7472617669732d63692e6f72672f6d74796d656b2f4d744d61696c2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/mtymek/MtMail)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ed346d721f73dac77f1a0f0a4f7d8a7762c20ef046b641ae3f214d2eda15e1b4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d74796d656b2f4d744d61696c2f6261646765732f7175616c6974792d73636f72652e706e673f733d66303364323231363137353563383435643063653036616239306136376366346533653334306530)](https://scrutinizer-ci.com/g/mtymek/MtMail/)[![Code Coverage](https://camo.githubusercontent.com/b1af6d6668e119d85b220db7a05487028fc6bacac2bd38734be6d28f74b95373/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d74796d656b2f4d744d61696c2f6261646765732f636f7665726167652e706e673f733d64346232616336333664343362336464383034323637356464333261633866653263663465333930)](https://scrutinizer-ci.com/g/mtymek/MtMail/)[![Latest Stable Version](https://camo.githubusercontent.com/cae5b18139eb2c68245f5052aae79c305f20d0c8a25215e2431ed62afe6214bf/68747470733a2f2f706f7365722e707567782e6f72672f6d74796d656b2f6d742d6d61696c2f762f737461626c652e706e67)](https://packagist.org/packages/mtymek/mt-mail)[![Total Downloads](https://camo.githubusercontent.com/7fa05909b9821d2a229f705527d9d8d8427bcee3cf78856add4881a172e4bc38/68747470733a2f2f706f7365722e707567782e6f72672f6d74796d656b2f6d742d6d61696c2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/mtymek/mt-mail)

Introduction
------------

[](#introduction)

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

### Features:

[](#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)

Installation is supported via Composer:

```
$ composer require mtymek/mt-mail
```

Creating e-mails
----------------

[](#creating-e-mails)

### Configuration

[](#configuration)

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

### Usage

[](#usage)

Creating message from controller:

```
$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).

### Layouts

[](#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:

```
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).

Sending e-mails
---------------

[](#sending-e-mails)

### Configuration

[](#configuration-1)

Update your application config:

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

[](#usage-1)

---

Add following code to your controller:

```
// 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).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 85.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~167 days

Recently: every ~91 days

Total

9

Last Release

3106d ago

PHP version history (2 changes)1.2.0PHP ^5.5 || ^7.0

1.3.0PHP ^5.6 || ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6c602b2763105f372ab3b806222f75b1872931a3451e8192c43d22287fde726?d=identicon)[mtymek](/maintainers/mtymek)

---

Top Contributors

[![mtymek](https://avatars.githubusercontent.com/u/777893?v=4)](https://github.com/mtymek "mtymek (176 commits)")[![ojhaujjwal](https://avatars.githubusercontent.com/u/4995501?v=4)](https://github.com/ojhaujjwal "ojhaujjwal (20 commits)")[![jaapio](https://avatars.githubusercontent.com/u/1060433?v=4)](https://github.com/jaapio "jaapio (4 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (2 commits)")[![stefanotorresi](https://avatars.githubusercontent.com/u/2952427?v=4)](https://github.com/stefanotorresi "stefanotorresi (2 commits)")[![mrova](https://avatars.githubusercontent.com/u/87153?v=4)](https://github.com/mrova "mrova (1 commits)")[![robob4him](https://avatars.githubusercontent.com/u/690413?v=4)](https://github.com/robob4him "robob4him (1 commits)")

---

Tags

emailmodulezf2e-mailmail templatemail transport

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mtymek-mt-mail/health.svg)

```
[![Health](https://phpackages.com/badges/mtymek-mt-mail/health.svg)](https://phpackages.com/packages/mtymek-mt-mail)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
