Search by

nixphp / mail

floknapp

This package is abandoned and no longer maintained. The author suggests using the naf/mail package instead.

NixPHP Mail Plugin for quick email communication.

Package info

github.com/nixphp/mail

Type:nixphp-plugin

pkg:composer/nixphp/mail

Statistics

Installs: 65

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2025-12-03 21:58 UTC

This package is auto-updated.

Last update: 2026-09-13 19:03:50 UTC


README

Important

NixPHP is now NAF — "Not Another Framework".

This package continues as naf/mail: github.com/nafphp/mail · documentation · what changed and how to move

composer require naf/mail

The old name collided with NixOS down to the shell, where the CLI binary was literally nix. This repository is archived and receives no further releases; nixphp/mail stays on Packagist so existing installations keep working.

Note the plugin type. NAF discovers plugins by the Composer type naf-plugin. A package still declaring nixphp-plugin is not loaded — silently, with no error.

Logo

NixPHP Mailer Plugin

← Back to NixPHP

nixphp/mail

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

  • ✅ 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

composer require nixphp/mail

🚀 Usage

📤 Basic mail sending

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

mailer()->send($mail);

📎 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('<img src="cid:logo.png">')

🔄 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

  • nixphp/framework >= 0.1.0
  • PHP >= 8.3

📄 License

MIT License.