Previous: MeTA1, Up: MTA Configuration [Contents][Index]
mailfromd
with PostfixTo configure postfix
to work with your filter, you
need to inform it about the socket your filter is listening on.
The smtpd_milters
(or non_smtpd_milters
) statement in
/etc/postfix/main.cf serves this purpose. If the filter is
to handle mail that arrives via SMTP, use
smtpd_milters
. If it is to handle mail submitted locally to the
queue, use non_smtpd_milters
. In both cases, the value
is a whitespace-separated list of socket addresses. Note, that Postfix
syntax for socket addresses differs from that used by Sendmail and
mailfromd. The differences are summarized in the following table:
Sendmail | Mailfromd | Postfix |
---|---|---|
inet:port@host | inet://host:port | inet:host:port |
unix:file | unix://file | unix:file |
For example, if your mailfromd
listens on
‘inet://127.0.0.1:4111’, add the following to
/etc/postfix/main.cf:
smtpd_milters = inet:127.0.0.1:4111
Mailfromd
uses Milter protocol version 6. Postfix, starting from
version 2.6 uses the same version. Older versions of Postfix use
Milter protocol 2 by default. Normally, it should not be a problem,
as mailfromd
tries to detect what version the server is
speaking. If, however, it fails to select the proper version, you
will have to instruct Postfix what version to use. To do so, add the
following statement to /etc/postfix/main.cf:
milter_protocol = 6
The way Postfix handles macros differs from that of Sendmail.
Postfix emulates a limited subset of Sendmail macros, and not
all of them are are available when you would expect them to. In
particular, the ‘i’ macro is not available before the ‘DATA’
stage, which brings two consequences. First, mailfromd
log
messages will not include message ID until the ‘DATA’ stage is
reached. Secondly, you cannot use ‘i’ in handlers ‘connect’,
‘helo’, ‘envfrom’ and ‘envrcpt’,
If you wish to tailor Postfix defaults to export the actual macros
used by your filter, run mailfromd --dump-macros
and filter
its output through the postfix-macros.sed filter, which is
installed to the prefix/share/mailfromd directory,
e.g.:
$ mailfromd --dump-macros | \ sed -f /usr/share/mailfromd/postfix-macros.sed milter_helo_macros = {s} milter_mail_macros = {client_addr} {s} {f} milter_rcpt_macros = {rcpt_addr} {f} {client_addr} milter_end_of_data_macros = {i}
Cut and paste its output to your /etc/postfix/main.cf.
For more details regarding Postfix interaction with Milter and available Postfix configuration options, see Postfix before-queue Milter support.
Previous: MeTA1, Up: MTA Configuration [Contents][Index]