PHPackages                             systream/mail-service - 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. [Templating &amp; Views](/categories/templating)
4. /
5. systream/mail-service

AbandonedArchivedLibrary[Templating &amp; Views](/categories/templating)

systream/mail-service
=====================

0.9.1(9y ago)214MITPHPPHP &gt;=5.4.0 || &gt;= 7.0

Since May 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/systream/mail-service)[ Packagist](https://packagist.org/packages/systream/mail-service)[ RSS](/packages/systream-mail-service/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Mail Service
============

[](#mail-service)

Mail template and queueing service.

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

[](#installation)

You can install this package via [packagist.org](https://packagist.org/packages/systream/mail-service) with [composer](https://getcomposer.org/).

`composer require systream/mail-service`

composer.json:

```
"require": {
    "systream/mail-service": "*"
}
```

This library requires `php 5.6` or higher.

Usage examples
--------------

[](#usage-examples)

### MailQueue

[](#mailqueue)

Create a simple mailQueue item with factory.

```
$item = Mail\MailQueueItem\MailQueueItemFactory::make('subject', 'Message for {$name}', 'recipient@email.hu', 'Recipent Name', array('name' => 'John'));
```

#### Formatters

[](#formatters)

You can add message formatters to a mailqueue item. For example a token formatter, which can replace the given tokens in the message and the subject.

You can add multiple message formatter.

```
$tokenFormatter = new TokenFormatter($tokens);
// ...
$mailQueueItem = new MailQueueItem($message);
$mailQueueItem->addMessageFormatter($tokenFormatter);
```

#### Mail templates

[](#mail-templates)

Mail templates gives the basic content of the message. This library provides a simple StringMailTemplate object, but you can easily add your custom. The only thing you needed to do is implement `MailTemplateInterface`.

```
$mailTemplate = new StringMailTemplate($body, $subject);
```

#### Recipients

[](#recipients)

One or more recipient can be added to the message.

```
$message = new Message($mailTemplate);
$message->addRecipient(new Recipient($recipientEmail, $recipientName));
```

#### Custom mailqueue item

[](#custom-mailqueue-item)

```
$tokenFormatter = new TokenFormatter($tokens);
$mailTemplate = new StringMailTemplate($body, $subject);
$message = new Message($mailTemplate);
$message->addRecipient(new Recipient($recipientEmail, $recipientName));
$mailQueueItem = new MailQueueItem($message);
$mailQueueItem->addMessageFormatter($tokenFormatter);
```

### Send message

[](#send-message)

You need a mailer and a Queue hadler.

#### Mail sender

[](#mail-sender)

This repository provides a phpmailler adapter for `MailSenderInterface`

```
$PHPMailer = new \PHPMailer(true);
$PHPMailer->isSMTP();
$PHPMailer->Host = "127.0.0.1";
$PHPMailer->Port = 1025;
$PHPMailer->SetFrom('test@unit.test');

$mailer = new Mail\MailSender\PHPMailerAdapter($PHPMailer);
```

#### Queue handler

[](#queue-handler)

##### Sqlite queue handler

[](#sqlite-queue-handler)

```
$mail = new Mail($mailer, new Mail\QueueHandler\SqliteQueHandlerAdapter());
```

### Sending immediate

[](#sending-immediate)

```
$mail->send($item);
```

### Add item to queue

[](#add-item-to-queue)

```
$mail->queue($item);
```

### Process Queue

[](#process-queue)

```
$mail->consume();
```

Set logger
----------

[](#set-logger)

You can use any PSR-3 compatible logger, for example monolog.

```
$mail->setLogger($logger);
```

Test
----

[](#test)

[![Build Status](https://camo.githubusercontent.com/fa799c3bd1e2bbc348cee7f76e3fc8edf6d168613b2bb201d734269f7e5dff59/68747470733a2f2f7472617669732d63692e6f72672f737973747265616d2f6d61696c2d736572766963652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/systream/mail-service)

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

3340d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c5ea6e7d8143a1fba541e1f41419cf36a4f970806d4bd91094d3b46177aea6d?d=identicon)[systream](/maintainers/systream)

---

Top Contributors

[![systream](https://avatars.githubusercontent.com/u/1583029?v=4)](https://github.com/systream "systream (10 commits)")

---

Tags

mailqueuetemplatemailtokentemplatemailqueuemailqmailque

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/systream-mail-service/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M19.7k](/packages/laravel-framework)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M724](/packages/sylius-sylius)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k13.0M215](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[laravel/nightwatch

The official Laravel Nightwatch package.

36210.1M34](/packages/laravel-nightwatch)

PHPackages © 2026

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