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

ActiveNixphp-plugin[Mail &amp; Notifications](/categories/mail)

nixphp/mail
===========

NixPHP Mail Plugin for quick email communication.

v0.1.0(7mo ago)039MITPHPPHP &gt;=8.3CI passing

Since Dec 2Pushed 7mo agoCompare

[ Source](https://github.com/nixphp/mail)[ Packagist](https://packagist.org/packages/nixphp/mail)[ RSS](/packages/nixphp-mail/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

[![Logo](https://camo.githubusercontent.com/075b2860e9651b98b8c190a8296595c54cff6900890d9e494f31131145e98a6f/68747470733a2f2f6e69787068702e6769746875622e696f2f646f63732f6173736574732f6e69787068702d6c6f676f2d736d616c6c2d7371756172652e706e67)](https://camo.githubusercontent.com/075b2860e9651b98b8c190a8296595c54cff6900890d9e494f31131145e98a6f/68747470733a2f2f6e69787068702e6769746875622e696f2f646f63732f6173736574732f6e69787068702d6c6f676f2d736d616c6c2d7371756172652e706e67)

[![NixPHP Mailer Plugin](https://github.com/nixphp/mailer/actions/workflows/php.yml/badge.svg)](https://github.com/nixphp/mailer/actions/workflows/php.yml)

[← Back to NixPHP](https://github.com/nixphp/framework)

---

nixphp/mail
===========

[](#nixphpmail)

> **A lightweight, extensible mailer system for NixPHP – with full transport abstraction and attachment support.**

This plugin provides a clean interface for sending emails in your NixPHP application. It includes a default `MailTransport` that uses PHP’s built-in `mail()` function, but can easily be swapped for SMTP, API-based services, or other custom transports.

> 🧩 Part of the official NixPHP plugin collection. Install it if you need flexible, framework-integrated email handling.

---

📦 Features
----------

[](#-features)

- ✅ Compose and send emails with fluent API
- ✅ Supports `To`, `Cc`, `Bcc`, `Reply-To`, and `Attachments`
- ✅ Sends HTML or plain text
- ✅ Fully transport-driven, extend, or swap backend logic
- ✅ Ships with default `MailTransport` using native PHP `mail()`

---

📥 Installation
--------------

[](#-installation)

```
composer require nixphp/mail
```

---

🚀 Usage
-------

[](#-usage)

### 📤 Basic mail sending

[](#-basic-mail-sending)

```
$mail = mail()
    ->setFrom('hello@example.com')
    ->addTo('john@example.com')
    ->setSubject('Hello from NixPHP')
    ->setContent('Welcome!', true);

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

---

### 📎 Add attachments

[](#-add-attachments)

```
$mail = mail()
    ->setFrom('info@example.com')
    ->addTo('client@example.com')
    ->setSubject('Monthly Report')
    ->addAttachment('report.pdf', '/path/to/report.pdf')

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

You can also attach images inline and reference them via `cid:`:

```
->addAttachment('logo.png', '/path/to/logo.png', true)
->setContent('')
```

---

### 🔄 Use a custom transport

[](#-use-a-custom-transport)

To swap out the default `MailTransport`, inject your own:

```
use NixPHP\Mail\Mailer;
use App\Mail\MyCustomTransport;

$mailer = new Mailer(new MyCustomTransport());
$mail   = mail()->addTo('john@example.com');
$mailer->send($mail);
```

Your transport must implement:

```
NixPHP\Mail\Core\TransportInterface
```

---

✅ Requirements
--------------

[](#-requirements)

- `nixphp/framework` &gt;= 0.1.0
- PHP &gt;= 8.3

---

📄 License
---------

[](#-license)

MIT License.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance65

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Unknown

Total

1

Last Release

211d ago

### Community

Maintainers

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

---

Top Contributors

[![FloKnapp](https://avatars.githubusercontent.com/u/3774820?v=4)](https://github.com/FloKnapp "FloKnapp (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[maize-tech/laravel-email-domain-rule

Laravel Email Domain Rule

612.0k](/packages/maize-tech-laravel-email-domain-rule)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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