MSH Software / blog

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

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.

More about MSH Postfix Milter

All posts