1PIPE(8)                     System Manager's Manual                    PIPE(8)
2
3
4

NAME

6       pipe - Postfix delivery to external command
7

SYNOPSIS

9       pipe [generic Postfix daemon options] command_attributes...
10

DESCRIPTION

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
17       next-hop host name can be specified as command-line macros that are ex‐
18       panded 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

SINGLE-RECIPIENT DELIVERY

26       Some destinations cannot handle more than one  recipient  per  delivery
27       request.  Examples  are pagers or fax machines.  In addition, multi-re‐
28       cipient delivery is undesirable  when  prepending  a  Delivered-to:  or
29       X-Original-To: message header.
30
31       To  prevent  Postfix  from sending multiple recipients per delivery re‐
32       quest, 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

COMMAND ATTRIBUTE SYNTAX

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 op‐
48              tional 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  ex‐
140                     pected 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 Re‐
146              turn-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  ad‐
155              dress 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              NOTE: DO NOT put quotes around the command, $sender, or $recipi‐
169              ent.
170
171              This feature is available as of Postfix 2.3.
172
173       size=size_limit (optional)
174              Don't deliver messages that exceed this size limit  (in  bytes);
175              return them to the sender instead.
176
177       user=username (required)
178
179       user=username:groupname
180              Execute  the  external  command with the user ID and group ID of
181              the specified username.  The software refuses  to  execute  com‐
182              mands  with  root privileges, or with the privileges of the mail
183              system owner. If groupname is specified, the corresponding group
184              ID is used instead of the group ID of username.
185
186       argv=command... (required)
187              The  command  to be executed. This must be specified as the last
188              command attribute.  The command is executed directly, i.e. with‐
189              out  interpretation  of shell meta characters by a shell command
190              interpreter.
191
192              Specify "{" and "}" around command arguments that contain white‐
193              space  (Postfix 3.0 and later). Whitespace after the opening "{"
194              and before the closing "}" is ignored.
195
196              In the command argument vector, the following macros are  recog‐
197              nized and replaced with corresponding information from the Post‐
198              fix queue manager delivery request.
199
200              In addition to the form ${name}, the forms $name and the  depre‐
201              cated form $(name) are also recognized.  Specify $$ where a sin‐
202              gle $ is wanted.
203
204              ${client_address}
205                     This macro expands to the remote client network address.
206
207                     This feature is available as of Postfix 2.2.
208
209              ${client_helo}
210                     This macro expands to the remote client HELO command  pa‐
211                     rameter.
212
213                     This feature is available as of Postfix 2.2.
214
215              ${client_hostname}
216                     This macro expands to the remote client hostname.
217
218                     This feature is available as of Postfix 2.2.
219
220              ${client_port}
221                     This macro expands to the remote client TCP port number.
222
223                     This feature is available as of Postfix 2.5.
224
225              ${client_protocol}
226                     This macro expands to the remote client protocol.
227
228                     This feature is available as of Postfix 2.2.
229
230              ${domain}
231                     This macro expands to the domain portion of the recipient
232                     address.  For example, with  an  address  user+foo@domain
233                     the domain is domain.
234
235                     This information is modified by the h flag for case fold‐
236                     ing.
237
238                     This feature is available as of Postfix 2.5.
239
240              ${extension}
241                     This macro expands to the extension part of  a  recipient
242                     address.   For  example,  with an address user+foo@domain
243                     the extension is foo.
244
245                     A command-line argument that  contains  ${extension}  ex‐
246                     pands  into  as  many command-line arguments as there are
247                     recipients.
248
249                     This information is modified by the u flag for case fold‐
250                     ing.
251
252              ${mailbox}
253                     This macro expands to the complete local part of a recip‐
254                     ient address.  For example, with an address  user+foo@do‐
255                     main the mailbox is user+foo.
256
257                     A  command-line argument that contains ${mailbox} expands
258                     to as many command-line arguments as  there  are  recipi‐
259                     ents.
260
261                     This information is modified by the u flag for case fold‐
262                     ing.
263
264              ${nexthop}
265                     This macro expands to the next-hop hostname.
266
267                     This information is modified by the h flag for case fold‐
268                     ing.
269
270              ${original_recipient}
271                     This  macro expands to the complete recipient address be‐
272                     fore any address rewriting or aliasing.
273
274                     A command-line argument that contains  ${original_recipi‐
275                     ent}  expands  to as many command-line arguments as there
276                     are recipients.
277
278                     This information is modified by the hqu flags for quoting
279                     and case folding.
280
281                     This feature is available as of Postfix 2.5.
282
283              ${queue_id}
284                     This macro expands to the queue id.
285
286                     This feature is available as of Postfix 2.11.
287
288              ${recipient}
289                     This macro expands to the complete recipient address.
290
291                     A  command-line  argument  that contains ${recipient} ex‐
292                     pands to as many command-line arguments as there are  re‐
293                     cipients.
294
295                     This information is modified by the hqu flags for quoting
296                     and case folding.
297
298              ${sasl_method}
299                     This macro expands to the name of the SASL authentication
300                     mechanism  in  the  AUTH  command  when  the Postfix SMTP
301                     server received the message.
302
303                     This feature is available as of Postfix 2.2.
304
305              ${sasl_sender}
306                     This macro expands to the  SASL  sender  name  (i.e.  the
307                     original submitter as per RFC 4954) in the MAIL FROM com‐
308                     mand when the Postfix SMTP server received the message.
309
310                     This feature is available as of Postfix 2.2.
311
312              ${sasl_username}
313                     This macro expands to the SASL user name in the AUTH com‐
314                     mand when the Postfix SMTP server received the message.
315
316                     This feature is available as of Postfix 2.2.
317
318              ${sender}
319                     This macro expands to the envelope sender address. By de‐
320                     fault, the null sender address expands to  MAILER-DAEMON;
321                     this  can  be  changed with the null_sender attribute, as
322                     described above.
323
324                     This information is modified by the q flag for quoting.
325
326              ${size}
327                     This macro expands to Postfix's idea of the message size,
328                     which  is  an approximation of the size of the message as
329                     delivered.
330
331              ${user}
332                     This macro expands to the username part  of  a  recipient
333                     address.   For  example,  with an address user+foo@domain
334                     the username part is user.
335
336                     A command-line argument  that  contains  ${user}  expands
337                     into  as many command-line arguments as there are recipi‐
338                     ents.
339
340                     This information is modified by the u flag for case fold‐
341                     ing.
342

STANDARDS

344       RFC 3463 (Enhanced status codes)
345

DIAGNOSTICS

347       Command  exit  status  codes are expected to follow the conventions de‐
348       fined in <sysexits.h>.  Exit status 0 means normal  successful  comple‐
349       tion.
350
351       In the case of a non-zero exit status, a limited amount of command out‐
352       put is logged, and reported in a delivery  status  notification.   When
353       the  output begins with a 4.X.X or 5.X.X enhanced status code, the sta‐
354       tus code takes precedence over the non-zero exit status  (Postfix  ver‐
355       sion 2.3 and later).
356
357       After  successful  delivery (zero exit status) a limited amount of com‐
358       mand output is logged, and reported in "success" delivery status  noti‐
359       fications (Postfix 3.0 and later).  This command output is not examined
360       for the presence of an enhanced status code.
361
362       Problems and transactions are  logged  to  syslogd(8)  or  postlogd(8).
363       Corrupted  message  files are marked so that the queue manager can move
364       them to the corrupt queue for further inspection.
365

SECURITY

367       This program needs a dual personality 1) to access the private  Postfix
368       queue  and  IPC  mechanisms, and 2) to execute external commands as the
369       specified user. It is therefore security sensitive.
370

CONFIGURATION PARAMETERS

372       Changes to main.cf are picked up automatically as pipe(8) processes run
373       for  only a limited amount of time. Use the command "postfix reload" to
374       speed up a change.
375
376       The text below provides only a parameter summary. See  postconf(5)  for
377       more details including examples.
378

RESOURCE AND RATE CONTROLS

380       In the text below, transport is the first field in a master.cf entry.
381
382       transport_time_limit ($command_time_limit)
383              A transport-specific override for the command_time_limit parame‐
384              ter value, where transport is the master.cf name of the  message
385              delivery transport.
386
387       Implemented in the qmgr(8) daemon:
388
389       transport_destination_concurrency_limit   ($default_destination_concur‐
390       rency_limit)
391              A transport-specific override for  the  default_destination_con‐
392              currency_limit parameter value, where transport is the master.cf
393              name of the message delivery transport.
394
395       transport_destination_recipient_limit     ($default_destination_recipi‐
396       ent_limit)
397              A transport-specific override for the default_destination_recip‐
398              ient_limit parameter value, where  transport  is  the  master.cf
399              name of the message delivery transport.
400

MISCELLANEOUS CONTROLS

402       config_directory (see 'postconf -d' output)
403              The  default  location of the Postfix main.cf and master.cf con‐
404              figuration files.
405
406       daemon_timeout (18000s)
407              How much time a Postfix daemon process may take to handle a  re‐
408              quest before it is terminated by a built-in watchdog timer.
409
410       delay_logging_resolution_limit (2)
411              The  maximal  number of digits after the decimal point when log‐
412              ging sub-second delay values.
413
414       export_environment (see 'postconf -d' output)
415              The list of environment variables that a  Postfix  process  will
416              export to non-Postfix processes.
417
418       ipc_timeout (3600s)
419              The  time limit for sending or receiving information over an in‐
420              ternal communication channel.
421
422       mail_owner (postfix)
423              The UNIX system account that owns the  Postfix  queue  and  most
424              Postfix daemon processes.
425
426       max_idle (100s)
427              The  maximum  amount of time that an idle Postfix daemon process
428              waits for an incoming connection before terminating voluntarily.
429
430       max_use (100)
431              The maximal number of incoming connections that a Postfix daemon
432              process will service before terminating voluntarily.
433
434       process_id (read-only)
435              The process ID of a Postfix command or daemon process.
436
437       process_name (read-only)
438              The process name of a Postfix command or daemon process.
439
440       queue_directory (see 'postconf -d' output)
441              The location of the Postfix top-level queue directory.
442
443       recipient_delimiter (empty)
444              The  set of characters that can separate an email address local‐
445              part, user name, or a .forward file name from its extension.
446
447       syslog_facility (mail)
448              The syslog facility of Postfix logging.
449
450       syslog_name (see 'postconf -d' output)
451              A prefix that  is  prepended  to  the  process  name  in  syslog
452              records, so that, for example, "smtpd" becomes "prefix/smtpd".
453
454       Available in Postfix version 3.0 and later:
455
456       pipe_delivery_status_filter ($default_delivery_status_filter)
457              Optional filter for the pipe(8) delivery agent to change the de‐
458              livery status code or explanatory text of successful  or  unsuc‐
459              cessful deliveries.
460
461       Available in Postfix version 3.3 and later:
462
463       enable_original_recipient (yes)
464              Enable  support  for the original recipient address after an ad‐
465              dress is rewritten to a  different  address  (for  example  with
466              aliasing or with canonical mapping).
467
468       service_name (read-only)
469              The master.cf service name of a Postfix daemon process.
470
471       Available in Postfix 3.5 and later:
472
473       info_log_address_format (external)
474              The  email  address  form that will be used in non-debug logging
475              (info, warning, etc.).
476

SEE ALSO

478       qmgr(8), queue manager
479       bounce(8), delivery status reports
480       postconf(5), configuration parameters
481       master(5), generic daemon options
482       master(8), process manager
483       postlogd(8), Postfix logging
484       syslogd(8), system logging
485

LICENSE

487       The Secure Mailer license must be distributed with this software.
488

AUTHOR(S)

490       Wietse Venema
491       IBM T.J. Watson Research
492       P.O. Box 704
493       Yorktown Heights, NY 10598, USA
494
495       Wietse Venema
496       Google, Inc.
497       111 8th Avenue
498       New York, NY 10011, USA
499
500
501
502                                                                       PIPE(8)
Impressum