mailman

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mailman

Mailman

Overview

概述

This skill provides guidance for configuring mailing list servers using Postfix and Mailman3. It covers the complete mail delivery pipeline including inbound mail handling, LMTP integration, subscription workflows, and outbound broadcast delivery to list subscribers.
本技能提供使用Postfix和Mailman3配置邮件列表服务器的指南,涵盖完整的邮件传递流程,包括入站邮件处理、LMTP集成、订阅工作流以及向列表订阅者的出站广播投递。

Architecture Understanding

架构理解

Before configuring, understand the bidirectional mail flow architecture:
在配置前,请先理解双向邮件流架构:

Inbound Flow (Mail INTO Mailman)

入站流程(邮件进入Mailman)

  1. External mail arrives at Postfix
  2. Postfix routes list addresses to Mailman via LMTP
  3. Mailman processes: subscriptions, unsubscriptions, and posts
  1. 外部邮件抵达Postfix
  2. Postfix通过LMTP将列表地址的邮件路由至Mailman
  3. Mailman处理订阅、退订和发帖请求

Outbound Flow (Mail OUT from Mailman)

出站流程(邮件从Mailman发出)

  1. Mailman processes incoming posts
  2. Mailman generates individual messages for each subscriber
  3. Mailman sends via Postfix back to subscriber mailboxes
  4. Messages arrive in subscriber local mailboxes (e.g., /var/mail/<user>)
Critical Insight: Both directions must work. A common failure mode is configuring only the inbound path while neglecting outbound delivery to subscribers.
  1. Mailman处理收到的发帖请求
  2. Mailman为每位订阅者生成独立的邮件
  3. Mailman通过Postfix将邮件发送回订阅者邮箱
  4. 邮件抵达订阅者的本地邮箱(例如:/var/mail/<user>
关键提示:两个方向的流程都必须正常工作。常见的失败模式是仅配置了入站路径,却忽略了向订阅者的出站投递。

Verification Strategy

验证策略

Mandatory Pre-Completion Verification

完成前的必选验证

Before declaring any mailing list setup complete, verify ALL three core functions:
  1. Join/Subscribe: User can join the mailing list
  2. Post/Broadcast: Messages sent to the list reach ALL subscribers
  3. Leave/Unsubscribe: User can leave the mailing list
在宣布任何邮件列表搭建完成前,需验证以下三项核心功能:
  1. 加入/订阅:用户可加入邮件列表
  2. 发帖/广播:发送至列表的邮件可送达所有订阅者
  3. 离开/退订:用户可退出邮件列表

End-to-End Testing Approach

端到端测试方法

To verify the complete mail flow:
  1. Test subscription
    • Send join request to list-join@domain
    • Verify confirmation arrives
    • Complete subscription process
  2. Test broadcast delivery (most commonly missed)
    • Send a message to list@domain
    • Check EACH subscriber's mailbox for delivery
    • Verify the message content is intact
  3. Test unsubscription
    • Send leave request to list-leave@domain
    • Verify confirmation and removal
要验证完整的邮件流:
  1. 测试订阅
    • 发送加入请求至list-join@domain
    • 确认收到确认邮件
    • 完成订阅流程
  2. 测试广播投递(最常被忽略的环节)
    • 发送邮件至list@domain
    • 检查每位订阅者的邮箱是否收到邮件
    • 确认邮件内容完整
  3. 测试退订
    • 发送退订请求至list-leave@domain
    • 确认收到确认邮件并已成功移除订阅

Log Analysis Checkpoints

日志分析检查点

Regularly inspect logs during configuration:
  • Postfix logs:
    /var/log/mail.log
    or
    journalctl -u postfix
  • Mailman logs:
    /var/log/mailman3/
    or check mailman's configured log directory
  • LMTP connection logs for both directions
配置期间需定期检查日志:
  • Postfix日志:
    /var/log/mail.log
    journalctl -u postfix
  • Mailman日志:
    /var/log/mailman3/
    或查看Mailman配置的日志目录
  • 双向LMTP连接日志

Common Configuration Points

常见配置要点

Postfix Configuration Areas

Postfix配置区域

Key files to examine and configure:
  • /etc/postfix/main.cf
    - Main configuration
  • /etc/postfix/master.cf
    - Service definitions
  • Transport maps for routing to Mailman
  • Virtual/relay domain configuration
需检查和配置的关键文件:
  • /etc/postfix/main.cf
    - 主配置文件
  • /etc/postfix/master.cf
    - 服务定义文件
  • 用于路由至Mailman的传输映射
  • 虚拟/中继域配置

Mailman3 Configuration Areas

Mailman3配置区域

Key areas to verify:
  • LMTP runner configuration (host and port)
  • MTA integration settings
  • Pipeline runners for processing posts
  • Outbound mail configuration
需验证的关键内容:
  • LMTP运行器配置(主机和端口)
  • MTA集成设置
  • 用于处理发帖的流水线运行器
  • 出站邮件配置

Integration Points to Verify

需验证的集成点

  1. LMTP Connection: Confirm Mailman's LMTP runner is listening on the configured port
  2. Transport Maps: Ensure Postfix routes list addresses correctly
  3. Domain Handling: Verify how list domains interact with
    mydestination
    and
    relay_domains
  4. Outbound Runner: Confirm Mailman's "out" runner sends messages back through Postfix
  1. LMTP连接:确认Mailman的LMTP运行器正在配置的端口上监听
  2. 传输映射:确保Postfix正确路由列表地址的邮件
  3. 域名处理:验证列表域名与
    mydestination
    relay_domains
    的交互方式
  4. 出站运行器:确认Mailman的"out"运行器通过Postfix发送邮件

Common Pitfalls

常见陷阱

Domain Configuration Conflicts

域名配置冲突

When the list domain is in Postfix's
mydestination
, Postfix treats ALL addresses at that domain as local. This can conflict with mailing list routing. Solutions include:
  • Using transport_maps to override for list addresses
  • Careful configuration of virtual domains
  • Verifying the routing precedence
当列表域名在Postfix的
mydestination
中时,Postfix会将该域名下的所有地址视为本地地址,这可能与邮件列表路由冲突。解决方案包括:
  • 使用transport_maps覆盖列表地址的路由
  • 谨慎配置虚拟域
  • 验证路由优先级

LMTP Verification Gaps

LMTP验证漏洞

A common mistake is assuming LMTP works for all message types because subscription requests succeed. Posts may fail separately. To verify:
  • Check that the LMTP port is actually listening
  • Test with actual post messages, not just subscription requests
  • Trace a post message through the complete pipeline
常见错误是因为订阅请求成功就假设LMTP对所有消息类型都正常工作,但发帖请求可能单独失败。验证方法:
  • 确认LMTP端口确实在监听
  • 使用实际的发帖请求进行测试,而非仅测试订阅请求
  • 跟踪发帖请求在完整流程中的传递路径

Incomplete Outbound Configuration

出站配置不完整

Mailman must send mail back to subscribers. Verify:
  • The "out" runner is active and processing
  • Mailman can connect to Postfix for sending
  • Subscriber addresses resolve correctly
  • Messages actually appear in subscriber mailboxes
Mailman必须能将邮件发送回订阅者。需验证:
  • "out"运行器处于活跃状态并正在处理请求
  • Mailman可连接至Postfix发送邮件
  • 订阅者地址解析正常
  • 邮件确实出现在订阅者的邮箱中

Premature Success Declaration

过早宣布配置成功

Never declare success based on:
  • A single test passing
  • Only subscription tests working
  • Automated tests that may not cover all functionality
Always manually verify the broadcast functionality before completion.
绝不能基于以下情况宣布配置成功:
  • 仅通过了一项测试
  • 仅订阅测试正常
  • 自动化测试可能未覆盖所有功能
在完成配置前,务必手动验证广播功能是否正常。

Debugging Approach

调试方法

When mail delivery fails:
  1. Trace the message path
    • Where does the message enter the system?
    • Does it reach Mailman's LMTP?
    • Does Mailman process it?
    • Does Mailman attempt outbound delivery?
    • Does Postfix accept the outbound message?
    • Does it reach the subscriber mailbox?
  2. Check queue directories
    • Postfix queue:
      mailq
      or
      postqueue -p
    • Mailman queues: Check configured queue directories
  3. Verify service status
    • All Mailman runners active
    • Postfix accepting connections
    • LMTP port listening
  4. Examine logs between each step
    • Do not restart services repeatedly without checking logs
    • Each restart should be followed by log examination
当邮件投递失败时:
  1. 跟踪邮件路径
    • 邮件从何处进入系统?
    • 它是否抵达Mailman的LMTP?
    • Mailman是否处理了该邮件?
    • Mailman是否尝试出站投递?
    • Postfix是否接受了出站邮件?
    • 邮件是否抵达订阅者邮箱?
  2. 检查队列目录
    • Postfix队列:
      mailq
      postqueue -p
    • Mailman队列:查看配置的队列目录
  3. 验证服务状态
    • 所有Mailman运行器均处于活跃状态
    • Postfix正在接受连接
    • LMTP端口正在监听
  4. 检查每个步骤之间的日志
    • 不要在未检查日志的情况下反复重启服务
    • 每次重启后都应检查日志

Incremental Verification Process

增量验证流程

Configure and verify in stages:
  1. Stage 1: Basic Postfix mail delivery (local mail works)
  2. Stage 2: Mailman installation and basic configuration
  3. Stage 3: LMTP connection (Postfix to Mailman)
  4. Stage 4: Subscription flow (join/leave)
  5. Stage 5: Broadcast flow (post to all subscribers)
  6. Stage 6: Full integration test with multiple subscribers
Do not proceed to the next stage until the current stage is verified working.
分阶段进行配置和验证:
  1. 阶段1:基础Postfix邮件投递(本地邮件可正常发送)
  2. 阶段2:Mailman安装与基础配置
  3. 阶段3:LMTP连接(Postfix至Mailman)
  4. 阶段4:订阅流程(加入/退订)
  5. 阶段5:广播流程(向所有订阅者发帖)
  6. 阶段6:多订阅者的完整集成测试
当前阶段验证通过前,请勿进入下一阶段。