承接 nixphp/mail 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nixphp/mail

最新稳定版本:v0.1.0

Composer 安装命令:

composer require nixphp/mail

包简介

NixPHP Mail Plugin for quick email communication.

README 文档

README

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.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-30