1PIPE(8) System Manager's Manual PIPE(8)
2
3
4
6 pipe - Postfix delivery to external command
7
9 pipe [generic Postfix daemon options] command_attributes...
10
12 The pipe(8) daemon processes requests from the Postfix queue manager to
13 deliver messages to external commands. This program expects to be run
14 from the master(8) process manager.
15
16 Message attributes such as sender address, recipient address and next-
17 hop host name can be specified as command-line macros that are expanded
18 before the external command is executed.
19
20 The pipe(8) daemon updates queue files and marks recipients as fin‐
21 ished, or it informs the queue manager that delivery should be tried
22 again at a later time. Delivery status reports are sent to the
23 bounce(8), defer(8) or trace(8) daemon as appropriate.
24
26 Some destinations cannot handle more than one recipient per delivery
27 request. Examples are pagers or fax machines. In addition, multi-
28 recipient delivery is undesirable when prepending a Delivered-to: or X-
29 Original-To: message header.
30
31 To prevent Postfix from sending multiple recipients per delivery
32 request, specify
33
34 transport_destination_recipient_limit = 1
35
36 in the Postfix main.cf file, where transport is the name in the first
37 column of the Postfix master.cf entry for the pipe-based delivery
38 transport.
39
41 The external command attributes are given in the master.cf file at the
42 end of a service definition. The syntax is as follows:
43
44 chroot=pathname (optional)
45 Change the process root directory and working directory to the
46 named directory. This happens before switching to the privileges
47 specified with the user attribute, and before executing the
48 optional directory=pathname directive. Delivery is deferred in
49 case of failure.
50
51 This feature is available as of Postfix 2.3.
52
53 directory=pathname (optional)
54 Change to the named directory before executing the external com‐
55 mand. The directory must be accessible for the user specified
56 with the user attribute (see below). The default working direc‐
57 tory is $queue_directory. Delivery is deferred in case of fail‐
58 ure.
59
60 This feature is available as of Postfix 2.2.
61
62 eol=string (optional, default: \n)
63 The output record delimiter. Typically one would use either \r\n
64 or \n. The usual C-style backslash escape sequences are recog‐
65 nized: \a \b \f \n \r \t \v \ddd (up to three octal digits) and
66 \\.
67
68 flags=BDFORXhqu.> (optional)
69 Optional message processing flags. By default, a message is
70 copied unchanged.
71
72 B Append a blank line at the end of each message. This is
73 required by some mail user agents that recognize "From "
74 lines only when preceded by a blank line.
75
76 D Prepend a "Delivered-To: recipient" message header with
77 the envelope recipient address. Note: for this to work,
78 the transport_destination_recipient_limit must be 1 (see
79 SINGLE-RECIPIENT DELIVERY above for details).
80
81 The D flag also enforces loop detection (Postfix 2.5 and
82 later): if a message already contains a Delivered-To:
83 header with the same recipient address, then the message
84 is returned as undeliverable. The address comparison is
85 case insensitive.
86
87 This feature is available as of Postfix 2.0.
88
89 F Prepend a "From sender time_stamp" envelope header to the
90 message content. This is expected by, for example, UUCP
91 software.
92
93 O Prepend an "X-Original-To: recipient" message header with
94 the recipient address as given to Postfix. Note: for this
95 to work, the transport_destination_recipient_limit must
96 be 1 (see SINGLE-RECIPIENT DELIVERY above for details).
97
98 This feature is available as of Postfix 2.0.
99
100 R Prepend a Return-Path: message header with the envelope
101 sender address.
102
103 X Indicate that the external command performs final deliv‐
104 ery. This flag affects the status reported in "success"
105 DSN (delivery status notification) messages, and changes
106 it from "relayed" into "delivered".
107
108 This feature is available as of Postfix 2.5.
109
110 h Fold the command-line $original_recipient and $recipient
111 address domain part (text to the right of the right-most
112 @ character) to lower case; fold the entire command-line
113 $domain and $nexthop host or domain information to lower
114 case. This is recommended for delivery via UUCP.
115
116 q Quote white space and other special characters in the
117 command-line $sender, $original_recipient and $recipient
118 address localparts (text to the left of the right-most @
119 character), according to an 8-bit transparent version of
120 RFC 822. This is recommended for delivery via UUCP or
121 BSMTP.
122
123 The result is compatible with the address parsing of com‐
124 mand-line recipients by the Postfix sendmail(1) mail sub‐
125 mission command.
126
127 The q flag affects only entire addresses, not the partial
128 address information from the $user, $extension or $mail‐
129 box command-line macros.
130
131 u Fold the command-line $original_recipient and $recipient
132 address localpart (text to the left of the right-most @
133 character) to lower case. This is recommended for deliv‐
134 ery via UUCP.
135
136 . Prepend "." to lines starting with ".". This is needed
137 by, for example, BSMTP software.
138
139 > Prepend ">" to lines starting with "From ". This is
140 expected by, for example, UUCP software.
141
142 null_sender=replacement (default: MAILER-DAEMON)
143 Replace the null sender address (typically used for delivery
144 status notifications) with the specified text when expanding the
145 $sender command-line macro, and when generating a From_ or
146 Return-Path: message header.
147
148 If the null sender replacement text is a non-empty string then
149 it is affected by the q flag for address quoting in command-line
150 arguments.
151
152 The null sender replacement text may be empty; this form is rec‐
153 ommended for content filters that feed mail back into Postfix.
154 The empty sender address is not affected by the q flag for
155 address quoting in command-line arguments.
156
157 Caution: a null sender address is easily mis-parsed by naive
158 software. For example, when the pipe(8) daemon executes a com‐
159 mand such as:
160
161 Wrong: command -f$sender -- $recipient
162
163 the command will mis-parse the -f option value when the sender
164 address is a null string. For correct parsing, specify $sender
165 as an argument by itself:
166
167 Right: command -f $sender -- $recipient
168
169 This feature is available as of Postfix 2.3.
170
171 size=size_limit (optional)
172 Don't deliver messages that exceed this size limit (in bytes);
173 return them to the sender instead.
174
175 user=username (required)
176
177 user=username:groupname
178 Execute the external command with the rights of the specified
179 username. The software refuses to execute commands with root
180 privileges, or with the privileges of the mail system owner. If
181 groupname is specified, the corresponding group ID is used
182 instead of the group ID of username.
183
184 argv=command... (required)
185 The command to be executed. This must be specified as the last
186 command attribute. The command is executed directly, i.e. with‐
187 out interpretation of shell meta characters by a shell command
188 interpreter.
189
190 In the command argument vector, the following macros are recog‐
191 nized and replaced with corresponding information from the Post‐
192 fix queue manager delivery request.
193
194 In addition to the form ${name}, the forms $name and $(name) are
195 also recognized. Specify $$ where a single $ is wanted.
196
197 ${client_address}
198 This macro expands to the remote client network address.
199
200 This feature is available as of Postfix 2.2.
201
202 ${client_helo}
203 This macro expands to the remote client HELO command
204 parameter.
205
206 This feature is available as of Postfix 2.2.
207
208 ${client_hostname}
209 This macro expands to the remote client hostname.
210
211 This feature is available as of Postfix 2.2.
212
213 ${client_port}
214 This macro expands to the remote client TCP port number.
215
216 This feature is available as of Postfix 2.5.
217
218 ${client_protocol}
219 This macro expands to the remote client protocol.
220
221 This feature is available as of Postfix 2.2.
222
223 ${domain}
224 This macro expands to the domain portion of the recipient
225 address. For example, with an address user+foo@domain
226 the domain is domain.
227
228 This information is modified by the h flag for case fold‐
229 ing.
230
231 This feature is available as of Postfix 2.5.
232
233 ${extension}
234 This macro expands to the extension part of a recipient
235 address. For example, with an address user+foo@domain
236 the extension is foo.
237
238 A command-line argument that contains ${extension}
239 expands into as many command-line arguments as there are
240 recipients.
241
242 This information is modified by the u flag for case fold‐
243 ing.
244
245 ${mailbox}
246 This macro expands to the complete local part of a recip‐
247 ient address. For example, with an address
248 user+foo@domain the mailbox is user+foo.
249
250 A command-line argument that contains ${mailbox} expands
251 to as many command-line arguments as there are recipi‐
252 ents.
253
254 This information is modified by the u flag for case fold‐
255 ing.
256
257 ${nexthop}
258 This macro expands to the next-hop hostname.
259
260 This information is modified by the h flag for case fold‐
261 ing.
262
263 ${original_recipient}
264 This macro expands to the complete recipient address
265 before any address rewriting or aliasing.
266
267 A command-line argument that contains ${original_recipi‐
268 ent} expands to as many command-line arguments as there
269 are recipients.
270
271 This information is modified by the hqu flags for quoting
272 and case folding.
273
274 This feature is available as of Postfix 2.5.
275
276 ${recipient}
277 This macro expands to the complete recipient address.
278
279 A command-line argument that contains ${recipient}
280 expands to as many command-line arguments as there are
281 recipients.
282
283 This information is modified by the hqu flags for quoting
284 and case folding.
285
286 ${sasl_method}
287 This macro expands to the name of the SASL authentication
288 mechanism in the AUTH command when the Postfix SMTP
289 server received the message.
290
291 This feature is available as of Postfix 2.2.
292
293 ${sasl_sender}
294 This macro expands to the SASL sender name (i.e. the
295 original submitter as per RFC 4954) in the MAIL FROM com‐
296 mand when the Postfix SMTP server received the message.
297
298 This feature is available as of Postfix 2.2.
299
300 ${sasl_username}
301 This macro expands to the SASL user name in the AUTH com‐
302 mand when the Postfix SMTP server received the message.
303
304 This feature is available as of Postfix 2.2.
305
306 ${sender}
307 This macro expands to the envelope sender address. By
308 default, the null sender address expands to MAILER-DAE‐
309 MON; this can be changed with the null_sender attribute,
310 as described above.
311
312 This information is modified by the q flag for quoting.
313
314 ${size}
315 This macro expands to Postfix's idea of the message size,
316 which is an approximation of the size of the message as
317 delivered.
318
319 ${user}
320 This macro expands to the username part of a recipient
321 address. For example, with an address user+foo@domain
322 the username part is user.
323
324 A command-line argument that contains ${user} expands
325 into as many command-line arguments as there are recipi‐
326 ents.
327
328 This information is modified by the u flag for case fold‐
329 ing.
330
332 RFC 3463 (Enhanced status codes)
333
335 Command exit status codes are expected to follow the conventions
336 defined in <sysexits.h>. Exit status 0 means normal successful comple‐
337 tion.
338
339 Postfix version 2.3 and later support RFC 3463-style enhanced status
340 codes. If a command terminates with a non-zero exit status, and the
341 command output begins with an enhanced status code, this status code
342 takes precedence over the non-zero exit status.
343
344 Problems and transactions are logged to syslogd(8). Corrupted message
345 files are marked so that the queue manager can move them to the corrupt
346 queue for further inspection.
347
349 This program needs a dual personality 1) to access the private Postfix
350 queue and IPC mechanisms, and 2) to execute external commands as the
351 specified user. It is therefore security sensitive.
352
354 Changes to main.cf are picked up automatically as pipe(8) processes run
355 for only a limited amount of time. Use the command "postfix reload" to
356 speed up a change.
357
358 The text below provides only a parameter summary. See postconf(5) for
359 more details including examples.
360
362 In the text below, transport is the first field in a master.cf entry.
363
364 transport_destination_concurrency_limit ($default_destination_concur‐
365 rency_limit)
366 Limit the number of parallel deliveries to the same destination,
367 for delivery via the named transport. The limit is enforced by
368 the Postfix queue manager.
369
370 transport_destination_recipient_limit ($default_destination_recipi‐
371 ent_limit)
372 Limit the number of recipients per message delivery, for deliv‐
373 ery via the named transport. The limit is enforced by the Post‐
374 fix queue manager.
375
376 transport_time_limit ($command_time_limit)
377 Limit the time for delivery to external command, for delivery
378 via the named transport. The limit is enforced by the pipe
379 delivery agent.
380
381 Postfix 2.4 and later support a suffix that specifies the time
382 unit: s (seconds), m (minutes), h (hours), d (days), w (weeks).
383 The default time unit is seconds.
384
386 config_directory (see 'postconf -d' output)
387 The default location of the Postfix main.cf and master.cf con‐
388 figuration files.
389
390 daemon_timeout (18000s)
391 How much time a Postfix daemon process may take to handle a
392 request before it is terminated by a built-in watchdog timer.
393
394 delay_logging_resolution_limit (2)
395 The maximal number of digits after the decimal point when log‐
396 ging sub-second delay values.
397
398 export_environment (see 'postconf -d' output)
399 The list of environment variables that a Postfix process will
400 export to non-Postfix processes.
401
402 ipc_timeout (3600s)
403 The time limit for sending or receiving information over an
404 internal communication channel.
405
406 mail_owner (postfix)
407 The UNIX system account that owns the Postfix queue and most
408 Postfix daemon processes.
409
410 max_idle (100s)
411 The maximum amount of time that an idle Postfix daemon process
412 waits for an incoming connection before terminating voluntarily.
413
414 max_use (100)
415 The maximal number of incoming connections that a Postfix daemon
416 process will service before terminating voluntarily.
417
418 process_id (read-only)
419 The process ID of a Postfix command or daemon process.
420
421 process_name (read-only)
422 The process name of a Postfix command or daemon process.
423
424 queue_directory (see 'postconf -d' output)
425 The location of the Postfix top-level queue directory.
426
427 recipient_delimiter (empty)
428 The separator between user names and address extensions
429 (user+foo).
430
431 syslog_facility (mail)
432 The syslog facility of Postfix logging.
433
434 syslog_name (see 'postconf -d' output)
435 The mail system name that is prepended to the process name in
436 syslog records, so that "smtpd" becomes, for example, "post‐
437 fix/smtpd".
438
440 qmgr(8), queue manager
441 bounce(8), delivery status reports
442 postconf(5), configuration parameters
443 master(5), generic daemon options
444 master(8), process manager
445 syslogd(8), system logging
446
448 The Secure Mailer license must be distributed with this software.
449
451 Wietse Venema
452 IBM T.J. Watson Research
453 P.O. Box 704
454 Yorktown Heights, NY 10598, USA
455
456
457
458 PIPE(8)