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