PHPackages                             pollen-solutions/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. pollen-solutions/mail

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

pollen-solutions/mail
=====================

Pollen Solutions - Mail Component - Tools for creating and sending emails.

v1.0.1(4y ago)16MITPHPPHP &gt;=7.4

Since Aug 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/pollen-solutions/mail)[ Packagist](https://packagist.org/packages/pollen-solutions/mail)[ Docs](https://www.presstify.com/pollen-solutions/mail/)[ RSS](/packages/pollen-solutions-mail/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (11)Versions (3)Used By (0)

Mail Component
==============

[](#mail-component)

[![Latest Stable Version](https://camo.githubusercontent.com/62215e081817188d4efab3c3ca8130158cec24f3b4c1edfc0f1f53f8f3d09f73/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f6c6c656e2d736f6c7574696f6e732f6d61696c2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/pollen-solutions/mail)[![MIT Licensed](https://camo.githubusercontent.com/daa52099573be5a50c320c4387496400f2f722e49f86a42db8d5778130d3582d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f7374796c653d666f722d7468652d6261646765)](LICENSE.md)[![PHP Supported Versions](https://camo.githubusercontent.com/d9d71d0b69072c51e1ff7adfdb6270f896f75787500ce6437120e23727c081d1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d372e342d3838393242463f7374796c653d666f722d7468652d6261646765266c6f676f3d706870)](https://www.php.net/supported-versions.php)

Pollen Solutions **Mail** Component provides tools for creating and sending emails.

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

[](#installation)

```
composer require pollen-solutions/mail
```

Basic Usage
-----------

[](#basic-usage)

### Send an email

[](#send-an-email)

```
use Pollen\Mail\MailManager;

$mail = new MailManager();

$mail->send([
    'to'   => ['to@domain.ltd', 'Recipient Name'],
    'from' => ['from@domain.ltd', 'Sender Name'],
]);
```

### Debug an email

[](#debug-an-email)

```
use Pollen\Mail\MailManager;

$mail = new MailManager();

$mail->debug([
    'to'   => ['to@domain.ltd', 'Recipient Name'],
    'from' => ['from@domain.ltd', 'Sender Name']
]);
```

### Queue an email (work in progress)

[](#queue-an-email-work-in-progress)

coming soon ...

Mail configuration
------------------

[](#mail-configuration)

```
/**
 * Name identifier in mail manager.
 * @var string|null
 */
'name'         => null,
/**
 * Recipients of the message.
 * @var string|array|null
 */
'to'           => null,
/**
 * Message sender.
 * @var string|array|null
 */
'from'         => null,
/**
 * Reply-to contact of the message.
 * @var string|array|null
 */
'reply-to'     => null,
/**
 * Blind carbon copy recipients of the message.
 * @var string|array|null
 */
'bcc'          => null,
/**
 * Carbon copy recipients of the message.
 * @var string|array|null
 */
'cc'           => null,
/**
 * Attachments of the message.
 * @var string|array|null
 */
'attachments'  => null,
/**
 * HTML content of the message.
 * {@internal false or empty to disable|true to use the html/message template|string of the HTML
 * content|array of message parts. The Array parts could have header|body|footer key and typed
 * as bool|string.}
 * @var bool|string|array|null
 */
'html'         => true,
/**
 * Plain text content of the message.
 * {@internal false or empty to disable|true to use the text/message template|string of text content.}
 * @var string|null
 */
'text'         => null,
/**
 * List of template datas.
 * @var array
 */
'datas'        => [],
/**
 * Subject of the message.
 * @var string
 */
'subject'      => 'Mail test',
/**
 * Locale of the message.
 * @var string
 */
'locale'       => 'en',
/**
 * Charset of the message.
 * @var string
 */
'charset'      => 'utf-8',
/**
 * Encoding of the message.
 * @var string|null 8bit|7bit|binary|base64|quoted-printable
 */
'encoding'     => null,
/**
 * Content type of the message.
 * @var string|null multipart/alternative|text/html|text/plain
 */
'content_type' => null,
/**
 * Css properties of the HTML message.
 * @var string
 */
'css'          => file_get_contents($this->mail()->resources('/assets/css/styles.css')),
/**
 * Inline CSS formatting flag.
 * @var bool
 */
'inline_css'   => true,
/**
 * List of parameters of the template view|View instance.
 * @var array|ViewInterface $view
 */
'view'         => [],
```

Use registered mail
-------------------

[](#use-registered-mail)

```
use Pollen\Mail\MailManager;

$mail = new MailManager();

$mail->setMailable([
    'name' => 'my-first-mail',
    'to'   => ['to@domain.ltd', 'Recipient Name'],
    'from' => ['from@domain.ltd', 'Sender Name'],
]);

if ($mailable = $mail->get('my-first-mail')) {
    $mailable->send();
}
```

Use Mailable
------------

[](#use-mailable)

### Send an email with the base Mailable

[](#send-an-email-with-the-base-mailable)

```
use Pollen\Mail\MailManager;
use Pollen\Mail\Mailable;

$mail = new MailManager();
$mailable = new Mailable($mail);
$mailable
    ->setFrom(['from@domain.ltd', 'Sender Name'])
    ->setTo(['to@domain.ltd', 'Recipient Name']);

$mailable->send();
```

### Send an email with a custom Mailable

[](#send-an-email-with-a-custom-mailable)

```
use Pollen\Mail\MailManager;
use Pollen\Mail\Mailable;

$mail = new MailManager();
$mailable = new class($mail) extends Mailable {
    protected ?array $from = ['from@domain.ltd', 'Sender Name'];
    protected ?array $to = ['to@domain.ltd', 'Recipient Name'];
};

$mailable->send();
```

Templating email
----------------

[](#templating-email)

@see

Tips
----

[](#tips)

### Email testing with MailHog

[](#email-testing-with-mailhog)

MailHog must be installed and running on your server.

More details :

1. Start MailHog with default configuration

```
~/go/bin/MailHog
```

2. Configure Pollen Mail Component for MailHog

```
use Pollen\Mail\MailManager;
use Pollen\Mail\Drivers\PhpMailerDriver;

$mail = new MailManager();
$mail->setMailerConfigCallback(function (PhpMailerDriver $mailer) {
    $mailer->isSMTP();
    $mailer->Host = '0.0.0.0';
    $mailer->Username = 'mailhog.example';
    $mailer->Port = 1025;
});

$mail->send();
```

Visit MailHog Web Ui :

### Configure MailHog in Wordpress

[](#configure-mailhog-in-wordpress)

For Wordpress environnement add this configuration in current theme functions.php

```
# functions.php
add_action('phpmailer_init', function (PHPMailer $mailer) {
    $mailer->isSMTP();
    $mailer->Host = '0.0.0.0';
    $mailer->Username = 'mailhog.example';
    $mailer->Port = 1025;
});
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1779d ago

### Community

Maintainers

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

---

Top Contributors

[![jordy-manner](https://avatars.githubusercontent.com/u/733356?v=4)](https://github.com/jordy-manner "jordy-manner (3 commits)")

---

Tags

cookiecomponentpollen-solutions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pollen-solutions-mail/health.svg)

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

###  Alternatives

[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k17.8k](/packages/prestashop-prestashop)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[october/rain

October Rain Library

1601.7M83](/packages/october-rain)[silverstripe/framework

The SilverStripe framework

7313.7M2.8k](/packages/silverstripe-framework)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.6M343](/packages/drupal-core-dev)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k16.4k79](/packages/elgg-elgg)

PHPackages © 2026

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