2 @cindex Postfix integration
4 @section Integration with Postfix
6 This section is taken from @url{http://www.postfix.org/UUCP_README.html,
7 Postfix and UUCP} manual and just replaces UUCP-related calls with NNCP
10 @strong{Setting up a Postfix Internet to NNCP gateway}
12 Here is how to set up a machine that sits on the Internet and that forwards
13 mail to a LAN that is connected via NNCP.
17 @item You need an @command{@ref{nncp-exec}} program that extracts the
18 sender address from mail that arrives via NNCP, and that feeds the mail
19 into the Postfix @command{sendmail} command.
21 @item Define a @command{pipe(8)} based mail delivery transport for
24 /usr/local/etc/postfix/master.cf:
25 nncp unix - n n - - pipe
26 flags=Rqhu user=nncp argv=nncp-exec -quiet $nexthop sendmail $recipient
29 This runs the @command{@ref{nncp-exec}} command to place outgoing mail into
30 the NNCP queue after replacing @var{$nexthop} by the receiving NNCP
31 node and after replacing @var{$recipient} by the recipients. The
32 @command{pipe(8)} delivery agent executes the @command{@ref{nncp-exec}}
33 command without assistance from the shell, so there are no problems with
34 shell meta characters in command-line parameters.
39 Pay attention to @code{flags}, containing @code{R}, telling Postfix to
40 include @code{Return-Path:} header. Otherwise that envelope sender
41 information may be lost. Possibly you will also need somehow to
42 preserve that header on the receiving side, because @command{sendmail}
43 command will replace it. For example you can rename it before feeding to
44 @command{sendmail} with
45 @code{reformail -R Return-Path: X-Original-Return-Path: | sendmail}, or
48 @verbatiminclude sendmail.sh
53 Also pay attention that @command{maildrop} does not like @code{From_}
54 mbox-style header, so you possibly want:
57 mailbox_command = reformail -f0 | maildrop -d $@{USER@}
60 @item Specify that mail for @emph{example.com}, should be delivered via
61 NNCP, to a host named @emph{nncp-host}:
64 /usr/local/etc/postfix/transport:
65 example.com nncp:nncp-host
66 .example.com nncp:nncp-host
69 See the @command{transport(5)} manual page for more details.
71 @item Execute the command @command{postmap /etc/postfix/transport}
72 whenever you change the @file{transport} file.
74 @item Enable @file{transport} table lookups:
77 /usr/local/etc/postfix/main.cf:
78 transport_maps = hash:$config_directory/transport
81 @item Add @emph{example.com} to the list of domains that your site is
82 willing to relay mail for.
85 /usr/local/etc/postfix/main.cf:
86 relay_domains = example.com @dots{}other relay domains@dots{}
89 See the @option{relay_domains} configuration parameter description for
92 @item Execute the command @command{postfix reload} to make the changes
97 @strong{Setting up a Postfix LAN to NNCP gateway}
99 Here is how to relay mail from a LAN via NNCP to the Internet.
103 @item You need an @command{@ref{nncp-exec}} program that extracts the
104 sender address from mail that arrives via NNCP, and that feeds the mail
105 into the Postfix @command{sendmail} command.
107 @item Specify that all remote mail must be sent via the @command{nncp}
108 mail transport to your NNCP gateway host, say, @emph{nncp-gateway}:
111 /usr/local/etc/postfix/main.cf:
112 relayhost = nncp-gateway
113 default_transport = nncp
116 Postfix 2.0 and later also allows the following more succinct form:
119 /usr/local/etc/postfix/main.cf:
120 default_transport = nncp:nncp-gateway
123 @item Define a @command{pipe(8)} based message delivery transport for
124 mail delivery via NNCP:
127 /usr/local/etc/postfix/master.cf:
128 nncp unix - n n - - pipe
129 flags=Fqhu user=nncp argv=nncp-exec -quiet $nexthop sendmail $recipient
132 This runs the @command{@ref{nncp-exec}} command to place outgoing mail into
133 the NNCP queue. It substitutes the hostname (@emph{nncp-gateway}, or
134 whatever you specified) and the recipients before execution of the
135 command. The @command{@ref{nncp-exec}} command is executed without assistance
136 from the shell, so there are no problems with shell meta characters.
138 @item Execute the command @command{postfix reload} to make the changes