2026-06-28 19:42:35 +08:00
2026-06-28 19:42:35 +08:00
2026-06-28 19:42:35 +08:00
2026-06-28 19:42:35 +08:00
2026-06-28 19:42:35 +08:00
2026-06-28 19:42:35 +08:00
2026-06-28 19:42:35 +08:00
2026-06-28 19:42:35 +08:00

kiri-mail-server

基于 PHP + Swoole 的生产级邮件服务器(Phase 1: SMTP 接收邮件)。

功能特性 (Phase 1)

  • SMTP 协议: 完整实现 RFC 5321,支持 EHLO/HELO、MAIL FROM、RCPT TO、DATA
  • ESMTP 扩展: 8BITMIME、PIPELINING、SIZE、AUTH
  • 认证: AUTH LOGIN / AUTH PLAIN
  • 存储: Maildir 格式存储,原子写入
  • kiri-core 集成: 继承 AbstractProcess,作为自定义进程运行

快速开始

安装

composer require game-worker/kiri-mail-server

配置

// config/mail.php
return [
    'smtp' => [
        'host'     => '0.0.0.0',
        'port'     => 25,
        'hostname' => 'mail.example.com',
    ],
    'storage' => [
        'path' => '/data/mail',
    ],
    'auth' => [
        'users' => [
            'user@example.com' => 'password123',
            'admin@example.com' => 'admin456',
        ],
    ],
    'domains' => [
        'local' => ['example.com'],
    ],
];

集成到 kiri-core

// config/servers.php
'process' => [
    \Kiri\MailServer\SmtpServerProcess::class,
],

测试 SMTP 连通性

# 连接 SMTP 服务器
telnet localhost 25

# 发送测试邮件
EHLO test
MAIL FROM:<sender@example.com>
RCPT TO:<user@example.com>
DATA
From: sender@example.com
To: user@example.com
Subject: Test

Hello World
.
QUIT

架构

详见 DESIGN.md

S
Description
No description provided
Readme 106 KiB
Languages
PHP 100%