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

ActiveLibrary

avzer/mail
==========

Library to send e-mails over different transports and protocols (like SMTP and IMAP) using immutable messages and streams. Also includes SMTP server.

1.0.1(1y ago)0251MITPHPPHP ^7.1

Since Jul 5Pushed 1y ago1 watchersCompare

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

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

Genkgo/Mail - Modern PHP 7.1+ Mail Library
==========================================

[](#genkgomail---modern-php-71-mail-library)

[![Latest Version](https://camo.githubusercontent.com/33893a4b3c6c0c2774c1843143960a93ee6965c741fd40828006abf4a4ab2c1c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f67656e6b676f2f6d61696c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/genkgo/mail/releases)[![Build Status](https://camo.githubusercontent.com/0c735986400a292869ba733c5cf06c47bdcdf6258abccd6b9bab6574b22f4128/68747470733a2f2f7472617669732d63692e6f72672f67656e6b676f2f6d61696c2e737667)](https://travis-ci.org/genkgo/mail)[![Build Status](https://camo.githubusercontent.com/4d799e04b3cd1aa4c91a7175b9d41e3820614ee11b5677cc92238367565c7099/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6b34793077716d386470333270626f313f7376673d74727565)](https://ci.appveyor.com/project/frederikbosch/mail)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c91f295814e26cb490c3a28690f58d667c3e158abbcae9067b41303a761cadc6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f67656e6b676f2f6d61696c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/genkgo/mail/)[![Code Coverage](https://camo.githubusercontent.com/5a40cce6fc850694905f1eb69dcd36120ea0ecf21c9498a2330ee92f8d42f198/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f67656e6b676f2f6d61696c2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/genkgo/mail/)

While analyzing what mail library to use when refactoring a code base, we discovered that the available ones are mostly legacy libraries. Some do not use namespaces and every library we encountered was merely a collection of scalar property bags than objects using encapsulation. Although we used these libs with joy in the past, they do not meet current quality standards. So, we built a new and better library according to modern programming principles.

Use this if you want to send e-mails over different transports and protocols using immutable messages and streams.

Send message quick and easy
---------------------------

[](#send-message-quick-and-easy)

```
$message = (new MessageBodyCollection('Hello World'))
    ->withAttachment(new FileAttachment('/order1.pdf', new ContentType('application/pdf')))
    ->createMessage()
    ->withHeader(new Subject('Hello World'))
    ->withHeader(From::fromEmailAddress('from@example.com'))
    ->withHeader(To::fromSingleRecipient('to@example.com', 'name'))
    ->withHeader(Cc::fromSingleRecipient('cc@example.com', 'name'));

$transport = new SmtpTransport(
    ClientFactory::fromString('smtp://user:pass@host/')->newClient(),
    EnvelopeFactory::useExtractedHeader()
);

$transport->send($message);
```

Install using composer
----------------------

[](#install-using-composer)

```
$ composer require genkgo/mail
```

Features
--------

[](#features)

- Use SMTP or mail() to send messages
- Use IMAPv4 to read messages from your mailbox (no extension required)
- Create replies and forward messages, including quoting of original message
- Queue messages when transport fails
- Automatically connects and reconnects after interval to SMTP server
- Automatically generate alternative text for formatted messages
- Optimal encoded headers, so no excessive (Q/B) encoded headers
- Optimal encoded multipart messages
- Only streams and connections are mutable
- Messages and actors are immutable
- Value objects protect against invalid states
- Streams make sure the library has a low memory burden
- Many objects but still easy API
- 90%+ test coverage
- Uses highest PHPStan detection level
- Only uses TLS &lt; 1.2 if not otherwise possible
- Discourages SSL
- DKIM signed message
- Security is highly prioritized
- SMTP server for testing purposes
- Great RFC compliance
- Cast messages to valid string source
- Library has no external dependencies (but uses intl extension)
- Only PHP 7.1 and up

Upcoming features
-----------------

[](#upcoming-features)

- Encrypted and signed messages

Not planned
-----------

[](#not-planned)

The following features are not planned for development by the owners, but could become part of the library when initiative is taken by the community.

- POP Support
- Mailbox abstraction layer

Documentation
-------------

[](#documentation)

- [English documentation](https://mail.readthedocs.io/)
- [PHP7.1未満お断り！最新PHPメーラーライブラリ Genkgo/Mail を試してみる - Qiita](https://qiita.com/mpyw/items/88161f9a809e063823c6)

RFC-compliance
--------------

[](#rfc-compliance)

This library tends to be as compliant with e-mail RFCs as possible. It should be compliant with the following RFCs.

- [RFC 821, Simple Mail Transfer Protocol](https://tools.ietf.org/html/rfc821)
- [RFC 1896, The text/enriched MIME Content-type](https://tools.ietf.org/html/rfc1896)
- [RFC 2822, Internet Message Format](https://tools.ietf.org/html/rfc2822)
- [RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part One](https://tools.ietf.org/html/rfc2045)
- [RFC 2046, Multipurpose Internet Mail Extensions (MIME) Part Two](https://tools.ietf.org/html/rfc2046)
- [RFC 2047, Multipurpose Internet Mail Extensions (MIME) Part Three](https://tools.ietf.org/html/rfc2047)
- [RFC 2048, Multipurpose Internet Mail Extensions (MIME) Part Four](https://tools.ietf.org/html/rfc2048)
- [RFC 2049, Multipurpose Internet Mail Extensions (MIME) Part Five](https://tools.ietf.org/html/rfc2049)
- [RFC 2392, Content-ID and Message-ID Uniform Resource Locators](https://tools.ietf.org/html/rfc2392)
- [RFC 2821, Simple Mail Transfer Protocol](https://tools.ietf.org/html/rfc2821)
- [RFC 3501, Internet Message Access Protocol - version 4rev1](https://tools.ietf.org/html/rfc3501)
- [RFC 4954, SMTP Service Extension for Authentication](https://tools.ietf.org/html/rfc4954)
- [RFC 5321, Simple Mail Transfer Protocol](https://tools.ietf.org/html/rfc5321)
- [RFC 6530, Overview and Framework for Internationalized Email](https://tools.ietf.org/html/rfc6530)

Credits
-------

[](#credits)

This library was not able to exist without [Zend/Mail](https://github.com/zendframework/zend-mail)and [PHPMailer](https://github.com/PHPMailer/PHPMailer).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

679d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/76933afad60d1b3da7f70a1029a892418411cbd15c092567b5bcf46780cb70a8?d=identicon)[avzer](/maintainers/avzer)

---

Top Contributors

[![avzer](https://avatars.githubusercontent.com/u/5896440?v=4)](https://github.com/avzer "avzer (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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