PHPackages                             ripaclub/zf2-mailman - 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. ripaclub/zf2-mailman

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

ripaclub/zf2-mailman
====================

ZF2 module to manage email delivery

v0.3.2(10y ago)73711[2 issues](https://github.com/ripaclub/zf2-mailman/issues)BSD-2-ClausePHPPHP &gt;=5.5

Since Oct 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/ripaclub/zf2-mailman)[ Packagist](https://packagist.org/packages/ripaclub/zf2-mailman)[ RSS](/packages/ripaclub-zf2-mailman/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (8)Versions (8)Used By (0)

ZF2 Mail Manager
================

[](#zf2-mail-manager)

[![Packagist](https://camo.githubusercontent.com/cf6322c91be7e5a672a94ddd12c08c645092fd97ddca5cde45d08752d72cc51a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72697061636c75622f7a66322d6d61696c6d616e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ripaclub/zf2-mailman) [![Travis branch](https://camo.githubusercontent.com/0d5e84a29947969e0207145b283e0434268a19e452f82e1cf9351840cfe49b96/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f72697061636c75622f7a66322d6d61696c6d616e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ripaclub/zf2-mailman) [![Coveralls branch](https://camo.githubusercontent.com/d06efb3d4451ff21817085f70f7bb025eaceafb6488e78ed13824be617921abb/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f72697061636c75622f7a66322d6d61696c6d616e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/ripaclub/zf2-mailman?branch=master)

What is this?
-------------

[](#what-is-this)

This is a ZF2 Module that gives you a simple way to configure one or multiple mail services.

It supports [all transports](https://github.com/zendframework/zf2/tree/master/library/Zend/Mail/Transport) shipped with ZF2, e.g. any transport that implements the `Zend\Mail\Transport\TransportInterface`.

It also has a transport for [Mandrill](http://mandrill.com). If you wish to use it install also `mandrill/mandrill` (versions 1.0.\*) library.

Installation
------------

[](#installation)

Add `ripaclub/zf2-mailman` to your `composer.json`.

```
{
   "require": {
       "ripaclub/zf2-mailman": "~0.3.2"
   }
}

```

Usage
-----

[](#usage)

Configure a transport in your configuration file.

```
'mailman' => [
    'MailMan\Gmail' => [
        'default_sender' => 'my-name-is-methos@gmail.com',
        'transport' => [
            'type' => 'smtp',
            'options' => [
                 'host' => 'smtp.gmail.com',
                 'port' => '587',
                 'connection_class' => 'login',
                 'connection_config' => [
                     'ssl' => 'tls',
                     'username' => 'my-name-is-methos@gmail.com',
                     'password' => 'MYSECRETPASSWORD',
                 ]
             ]
        ],
    ],
],
```

Do not forget to add **MailMan** module to you `application.config.php` file.

```
'modules' => [
        // ...
        'MailMan',
        'Application',
],
```

**Text only message**

Then we send a text only message.

```
$message = new \MailMan\Message();
$message->addTextPart('Test email');
$message->setSubject('My name is methos');
$message->addFrom('my-name-is-methos@gmail.com', 'Methos');
$message->addTo('ripaclub@gmail.com', 'RipaClub');
/** @var \MailMan\Service\MailService $mailService */
$mailService = $this->getServiceLocator()->get('MailMan\Gmail');
$mailService->send($message);
```

**Message with attachment**

Do you want to send an email message with an attachment from filesystem?

```
$message = new \MailMan\Message();
$message->addAttachment('/path/to/an/attachment.png');
$message->setBody('Test email');
$message->setSubject('My name is methos');
$message->addFrom('my-name-is-methos@gmail.com', 'Methos');
$message->addTo('ripaclub@gmail.com', 'RipaClub');
/** @var \MailMan\Service\MailService $mailService */
$mailService = $this->getServiceLocator()->get('MailMan\Gmail');
$mailService->send($message);
```

**Message using a template**

```
$content = new ViewModel();
$content->setTemplate('email/example.phtml');
$content->setVariable('name', 'RipaClub');
$message = new \MailMan\Message();
$message->setSubject('Example email');
$message->addHtmlPart($this->getServiceLocator()->get('ViewRenderer')->render($content));
$message->addTo('ripaclub@gmail.com', 'RipaClub');
/** @var $mailService \MailMan\Service\MailService */
$mailService = $this->getServiceLocator()->get('MailMan\Gmail');
$mailService->send($message);
```

The content of `email/example.phtml` file will be:

```
Hi ,
This is an example email with template.
```

Transports configuration examples
---------------------------------

[](#transports-configuration-examples)

### Mandrill

[](#mandrill)

To use the Mandrill transport add `"mandrill/mandrill"` to your `composer.json`.

Then configure it.

```
'mailman' => [
    'MailMan\Mandrill' => [
        'default_sender' => 'test@mail.com',
        'transport' => [
            'type' => 'mandrill',
            'options' => [
                'api_key' => 'MYSECRETMANDRILLKEY',
                'sub_account' => 'my-optional-subaccount-if-any'
            ],
        ],
    ],
]
```

### SMTP

[](#smtp)

In this example we use the SMTP transport (shipped by ZF2).

```
'mailman' => [
    'MailMan\SMTP' => [
        'default_sender' => 'my-name-is-methos@gmail.com',
        'transport' => [
            'type' => 'smtp',
            'options' => [
                 'host' => 'smtp.gmail.com',
                 'port' => '587',
                 'connection_class' => 'login',
                 'connection_config' => [
                     'ssl' => 'tls',
                     'username' => 'my-name-is-methos@gmail.com',
                     'password' => 'MYSECRETPASSWORD',
                 ]
             ]
        ],
    ],
],
```

### Sendmail

[](#sendmail)

In this example we use the Sendmail transport (shipped by ZF2).

```
'mailman' => [
    'MailMan\Sendmail' => [
        'default_sender' => 'my-name-is-methos@yourdomain.com',
        'transport' => [
            'type' => 'sendmail'
        ],
    ],
],
```

---

[![Analytics](https://camo.githubusercontent.com/e6e5f858c113b4f2e8c14120a3356145ead2d6bd5e78e6f4a74c6a4d87f6be24/68747470733a2f2f67612d626561636f6e2e61707073706f742e636f6d2f55412d34393635373137362d332f7a66322d6d61696c6d616e)](https://github.com/igrigorik/ga-beacon)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~168 days

Total

4

Last Release

3758d ago

PHP version history (2 changes)v0.2.0PHP &gt;=5.4

v0.3.2PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/504f6b7857bcaa1337d91366a2768d65dcfcdf12ca9281422f7b4d9404aba4ac?d=identicon)[fntlnz](/maintainers/fntlnz)

![](https://avatars.githubusercontent.com/u/120051?v=4)[Leo Di Donato](/maintainers/leodido)[@leodido](https://github.com/leodido)

![](https://avatars.githubusercontent.com/u/3390997?v=4)[Leonardo Grasso](/maintainers/leogr)[@leogr](https://github.com/leogr)

![](https://avatars.githubusercontent.com/u/3627018?v=4)[visa4](/maintainers/visa4)[@visa4](https://github.com/visa4)

---

Top Contributors

[![fntlnz](https://avatars.githubusercontent.com/u/3083633?v=4)](https://github.com/fntlnz "fntlnz (32 commits)")[![leodido](https://avatars.githubusercontent.com/u/120051?v=4)](https://github.com/leodido "leodido (28 commits)")[![visa4](https://avatars.githubusercontent.com/u/3627018?v=4)](https://github.com/visa4 "visa4 (26 commits)")[![leogr](https://avatars.githubusercontent.com/u/3390997?v=4)](https://github.com/leogr "leogr (7 commits)")[![theboolean](https://avatars.githubusercontent.com/u/1123102?v=4)](https://github.com/theboolean "theboolean (4 commits)")

---

Tags

messagemailemailfilememoryzfmessagesmandrillsmtpsendmailZend Frameworkmail manager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ripaclub-zf2-mailman/health.svg)

```
[![Health](https://phpackages.com/badges/ripaclub-zf2-mailman/health.svg)](https://phpackages.com/packages/ripaclub-zf2-mailman)
```

###  Alternatives

[thefox/smtpd

SMTP server (library) written in pure PHP.

1282.5k1](/packages/thefox-smtpd)[swissup/module-email

Magento2 email providers integration (smtp, mandrill, amazon ses)

1413.6k1](/packages/swissup-module-email)

PHPackages © 2026

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