Why a Milter and Not alterMIME
Ask how to add a disclaimer on a Postfix server and the answer is often fifteen years old: a
content_filter entry in master.cf, a shell script, and alterMIME appending a text file to
outgoing mail. It works, and for a plain text footer on a single domain we would not tell anyone
to replace it. But the moment the requirements grow, the place where that setup sits in Postfix
starts to matter more than the tool itself.
Outside the conversation, or inside it
A content filter takes the message after Postfix has accepted it, pipes it to a script, and the
script hands a changed copy back to Postfix with sendmail. Every message is received twice, a
filter user and a spool directory have to exist, and the script decides everything with grep
and exit codes. Mail that does not pass through the service the filter is attached to, often the
submission ports 587 and 465, quietly skips it.
A milter sits inside the SMTP conversation. Postfix asks it about each message before accepting it,
the message is changed in place, and nothing is re-injected. smtpd_milters covers every smtpd
service at once, and non_smtpd_milters covers mail from cron jobs and local applications.
What that means in practice
- Order you can control. Milters run in the order they are listed, so a disclaimer added before OpenDKIM signs the message no longer breaks the DKIM signature.
- Mail flows when the milter does not. With
milter_default_action=accept, Postfix keeps delivering mail, unchanged, while the milter is down. - Rules instead of scripts. Conditions on sender, recipient, direction, group or subject replace
the
ifstatements, and the Rules Tester shows the result before any real mail is sent. - Knowledge of the message. HTML and plain text versions both get the footer, per-user details come from the directory, and a disclaimer already in the thread is not added again.
alterMIME itself is barely maintained: its official changelog stops in 2010. It still builds and distributions still ship it, but every new requirement becomes more shell script around it.
Moving across
The milter and the content filter are independent, so the move can happen side by side: set up the
milter, test it, register it, and remove the content_filter line with one postfix reload.
Read more on the alterMIME alternative page and in the Postfix configuration documentation.
To learn more visit MSH Postfix Milter website.