]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.3-20051114
authorWietse Venema <wietse@porcupine.org>
Mon, 14 Nov 2005 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:31:42 +0000 (06:31 +0000)
32 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/conf/postfix-files
postfix/html/Makefile.in
postfix/html/bounce.5.html [new file with mode: 0644]
postfix/html/bounce.8.html
postfix/html/postconf.1.html
postfix/html/postconf.5.html
postfix/html/postfix-manuals.html
postfix/html/postfix.1.html
postfix/man/Makefile.in
postfix/man/man1/postconf.1
postfix/man/man1/postfix.1
postfix/man/man5/bounce.5 [new file with mode: 0644]
postfix/man/man5/postconf.5
postfix/man/man8/bounce.8
postfix/mantools/postlink
postfix/proto/bounce [new file with mode: 0644]
postfix/proto/postconf.proto
postfix/src/bounce/Makefile.in
postfix/src/bounce/annotate.pl [moved from postfix/src/bounce/fix-template.pl with 56% similarity]
postfix/src/bounce/bounce.c
postfix/src/bounce/bounce_notify_util.c
postfix/src/bounce/bounce_service.h
postfix/src/bounce/bounce_template.c
postfix/src/global/mail_version.h
postfix/src/master/multi_server.c
postfix/src/master/single_server.c
postfix/src/master/trigger_server.c
postfix/src/postconf/Makefile.in
postfix/src/postconf/postconf.c
postfix/src/postfix/postfix.c

index 8c4e6961e5dba92fcac7f76ba9bd75ce90a46b6b..57780f515bbfb026e0381a2834e24e25ef6deb9f 100644 (file)
@@ -11368,13 +11368,31 @@ Apologies for any names omitted.
 
 20051112
 
-       Feature (grumble): configurable bounce message templates
-       based on contribution by Nicolas Riendeau. I kept the general
-       format of his templates, but placed them together in one
-       file to reduce process initialization overhead. Files:
-       bounce/bounce_template.c, bounce/dict_ml.c (to be moved to
-       library if useful enough). A sample bounce message template
-       file is installed as $config_directory/bounce.cf.default.
+       Feature: configurable bounce message templates based on
+       contribution by Nicolas Riendeau. I kept the general format
+       of his templates, but placed them together in one file to
+       reduce process initialization overhead (most requests to
+       the bounce daemon are not for sending bounce messages).
+       Files: bounce/bounce_template.c, bounce/dict_ml.c (to be
+       moved to library if useful enough). A sample bounce message
+       template file is installed as $config_directory/bounce.cf.default.
+
+20051113
+
+       Feature: "postconf -b filename" to preview the non-default
+       bounce message templates with $name expansions in the text.
+       The actual work is of course done by the bounce daemon.
+
+20051114
+
+       Feature: -V option to make Postfix daemons to log to stderr.
+       This is used when a daemon is invoked in stand-alone mode
+       by a (non-daemon) command.
+
+       Feature: "postconf -t" displays DSN templates, headers and
+       all; use postconf -t ''" to view built-ins.
+
+       Cleanup: renamed fail_template into failure_template.
 
 Open problems:
 
index 29630648f6e003ba0a4a6066c826a4abbab10b39..1ae66908bffb44a9f37eeeb3986c3211df1e4d2f 100644 (file)
@@ -17,6 +17,35 @@ Incompatibility with Postfix 2.1 and earlier
 If you upgrade from Postfix 2.1 or earlier, read RELEASE_NOTES-2.2
 before proceeding.
 
+Major changes with snapshot 20051113
+====================================
+
+Configurable bounce messages, based on a format that was developed
+by Nicolas Riendeau. The file with templates is specified with the
+bounce_template_file parameter. Details are in the bounce(5) manual
+page, and examples of the built-in templates can be found in a file
+bounce.cf.default in the Postfix configuration directory. The
+template for the default bounce message looks like this:
+
+    failure_template = <<EOF
+    Charset: us-ascii
+    From: MAILER-DAEMON (Mail Delivery System)
+    Subject: Undelivered Mail Returned to Sender
+    Postmaster-Subject: Postmaster Copy: Undelivered Mail
+
+    This is the $mail_name program at host $myhostname.
+
+    I'm sorry to have to inform you that your message could not
+    be delivered to one or more recipients. It's attached below.
+
+    For further assistance, please send mail to <postmaster>
+
+    If you do so, please include this problem report. You can
+    delete your own text from the attached returned message.
+
+                            The $mail_name program
+    EOF
+
 Incompatibility with snapshot 20051106
 ======================================
 
index 0ff7c876e2fa1959ff5f00dbf5f064d7db546313..ee99c10ee01676cf91cd7343ab7945a6f9840347 100644 (file)
@@ -143,6 +143,7 @@ $manpage_directory/man1/sendmail.1:f:root:-:644
 $manpage_directory/man5/access.5:f:root:-:644
 $manpage_directory/man5/aliases.5:f:root:-:644
 $manpage_directory/man5/body_checks.5:f:root:-:644
+$manpage_directory/man5/bounce.5:f:root:-:644
 $manpage_directory/man5/canonical.5:f:root:-:644
 $manpage_directory/man5/cidr_table.5:f:root:-:644
 $manpage_directory/man5/generics.5:f:root:-:644:o
index 139345aede675439b76bd9d23e6bb1457872a99e..2f8100480e8b8dbc83086e9d5733376539e88d4d 100644 (file)
@@ -18,7 +18,7 @@ CONFIG        = access.5.html aliases.5.html canonical.5.html relocated.5.html \
        transport.5.html virtual.5.html pcre_table.5.html regexp_table.5.html \
        cidr_table.5.html tcp_table.5.html header_checks.5.html \
        ldap_table.5.html mysql_table.5.html pgsql_table.5.html \
-       master.5.html nisplus_table.5.html generic.5.html
+       master.5.html nisplus_table.5.html generic.5.html bounce.5.html
 OTHER  = postfix-manuals.html
 AWK    = awk '{ print; if (NR == 2) print ".pl 9999\n.ll 65" }'
 MAN2HTML = man2html -t "Postfix manual - `IFS=.; set \`echo $@\`; echo \"$$1($$2)\"`"
@@ -229,6 +229,10 @@ aliases.5.html: ../proto/aliases
        PATH=../mantools:$$PATH; \
        srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@
 
+bounce.5.html: ../proto/bounce
+       PATH=../mantools:$$PATH; \
+       srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@
+
 canonical.5.html: ../proto/canonical
        PATH=../mantools:$$PATH; \
        srctoman - $? | $(AWK) | nroff -man | uniq | $(MAN2HTML) | postlink >$@
diff --git a/postfix/html/bounce.5.html b/postfix/html/bounce.5.html
new file mode 100644 (file)
index 0000000..5101a56
--- /dev/null
@@ -0,0 +1,196 @@
+<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
+        "http://www.w3.org/TR/html4/loose.dtd">
+<html> <head>
+<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+<title> Postfix manual - bounce(5) </title>
+</head> <body> <pre>
+BOUNCE(5)                                                            BOUNCE(5)
+
+<b>NAME</b>
+       bounce - Postfix bounce message template format
+
+<b>SYNOPSIS</b>
+       <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a> = /etc/postfix/bounce.cf</b>
+
+       <b>postconf -b</b> [<i>template</i><b>_</b><i>file</i>]
+
+<b>DESCRIPTION</b>
+       The  Postfix  <a href="bounce.8.html"><b>bounce</b>(8)</a>  server  produces  delivery status
+       notification  (DSN)  messages  for   undeliverable   mail,
+       delayed  mail, successful delivery or address verification
+       requests.
+
+       By default, these notifications are generated from  built-
+       in  templates with message headers and message text. Sites
+       can override the  built-in  information  by  specifying  a
+       bounce template file with the <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a></b> config-
+       uration parameter.
+
+       This document describes the general procedure to create  a
+       bounce  template file, followed by the specific details of
+       bounce template formats.
+
+<b>GENERAL PROCEDURE</b>
+       To create customized bounce template file, create a tempo-
+       rary  copy  of the file <b>/etc/postfix/bounce.cf.default</b> and
+       edit the temporary file.
+
+       To preview the results of $<i>name</i> expansions in the template
+       text, use the command
+
+           <b>postconf -b</b> <i>temporary</i><b>_</b><i>file</i>
+
+       Errors  in  the  template will be reported to the standard
+       error stream and to the syslog daemon.
+
+       While previewing the  text,  be  sure  to  pay  particular
+       attention  to  the expansion of time value parameters that
+       appear in the delayed mail notification text.
+
+       Once the result is satisfactory, copy the template to  the
+       Postfix  configuration  directory  and  specify in main.cf
+       something like:
+
+       /etc/postfix/main.cf:
+               <a href="postconf.5.html#bounce_template_file">bounce_template_file</a> = /etc/postfix/bounce.cf
+
+<b>TEMPLATE FILE FORMAT</b>
+       The template file can specify templates for  failed  mail,
+       delayed mail, successful delivery or for address verifica-
+       tion.   These  templates   are   named   <b>failure_template</b>,
+       <b>delay_template</b>,   <b>success_template</b>   and  <b>verify_template</b>,
+       respectively.  You can but do not have to specify all four
+       templates in a bounce template file.
+
+       Each template starts with "<i>template</i><b>_</b><i>name</i> <b>=</b> &lt;&lt;<b>EOF</b>" and ends
+       with a line that contains the word  "<b>EOF</b>"  only.  You  can
+       change the word EOF, but you can't enclose it in quotes as
+       with the shell or with  Perl  (<i>template</i><b>_</b><i>name</i>  <b>=</b>  &lt;&lt;<b>'EOF'</b>).
+       Here is an example:
+
+         # The failure template is used for undeliverable mail.
+
+         failure_template = &lt;&lt;EOF
+         Charset: us-ascii
+         From: MAILER-DAEMON (Mail Delivery System)
+         Subject: Undelivered Mail Returned to Sender
+         Postmaster-Subject: Postmaster Copy: Undelivered Mail
+
+         This is the $<a href="postconf.5.html#mail_name">mail_name</a> program at host $<a href="postconf.5.html#myhostname">myhostname</a>.
+
+         I'm sorry to have to inform you that your message could not
+         be delivered to one or more recipients. It's attached below.
+
+         For further assistance, please send mail to &lt;postmaster&gt;
+
+         If you do so, please include this problem report. You can
+         delete your own text from the attached returned message.
+
+                                        The $<a href="postconf.5.html#mail_name">mail_name</a> program
+         EOF
+
+       No  special meaning is given to the backslash character or
+       to leading whitespace; these are always taken literally.
+
+       Outside the &lt;&lt;  context,  lines  beginning  with  "#"  are
+       ignored,  as  are  empty  lines,  and  lines consisting of
+       whitespace only.
+
+       Examples of  all  templates  can  be  found  in  the  file
+       <b>bounce.cf.default</b>  in the Postfix configuration directory.
+
+<b>TEMPLATE HEADER FORMAT</b>
+       The  first  portion  of  a  bounce  template  consists  of
+       optional  template  headers.   These either become message
+       headers in the delivery status  notification,  or  control
+       the  formatting of the notification. Headers not specified
+       in a template will be left at their default value.
+
+       The following headers are supported:
+
+       <b>Charset:</b>
+              The MIME character  set  of  the  template  message
+              text.   See  the  "TEMPLATE  MESSAGE  TEXT  FORMAT"
+              description below.
+
+       <b>From:</b>  The sender address that the recipient will see.
+
+       <b>Subject:</b>
+              The subject that the recipient will see.
+
+       <b>Postmaster-Subject:</b>
+              The subject that will be used in Postmaster  copies
+              of  undeliverable  or  delayed  mail notifications.
+              These  copies  are  sent  under  control   of   the
+              <a href="postconf.5.html#notify_classes">notify_classes</a> configuration parameter.
+
+       The usage and specification of template message headers is
+       subject to the following restrictions:
+
+       <b>o</b>      Template message header names can be  specified  in
+              upper  case,  lower  case  or  mixed  case. Postfix
+              always uses the spelling as shown  in  the  example
+              above.
+
+       <b>o</b>      Template  message  headers  must  not span multiple
+              lines.
+
+       <b>o</b>      Template message headers must not  contain  main.cf
+              $parameters.
+
+       <b>o</b>      Template message headers must contain ASCII charac-
+              ters only.
+
+<b>TEMPLATE MESSAGE TEXT FORMAT</b>
+       The second portion of a bounce template consists  of  mes-
+       sage  text.  As  the above example shows, template message
+       text may contain main.cf $parameters. Besides the  parame-
+       ters that are defined in main.cf, the following parameters
+       are treated specially depending  on  the  suffix  that  is
+       appended to their name.
+
+       <b>delay_warning_time_</b><i>suffix</i>
+              Expands  into  the  value of the <b><a href="postconf.5.html#delay_warning_time">delay_warning_time</a></b>
+              parameter, expressed in the time unit specified  by
+              <i>suffix</i>,  which  is  one of <b>seconds</b>, <b>minutes</b>, <b>hours,</b>
+              <b>days</b>, or <b>weeks</b>.
+
+       <b>maximal_queue_lifetime_</b><i>suffix</i>
+              Expands into the value of  the  <b><a href="postconf.5.html#maximal_queue_lifetime">maximal_queue_life</a>-</b>
+              <b><a href="postconf.5.html#maximal_queue_lifetime">time</a></b>  parameter,  expressed in the time unit speci-
+              fied by <i>suffix</i>.  See above under <b><a href="postconf.5.html#delay_warning_time">delay_warning_time</a></b>
+              for possible <i>suffix</i> values.
+
+       The  usage  and  specification of template message text is
+       subject to the following restrictions:
+
+       <b>o</b>      The template message text is not sent in Postmaster
+              copies of delivery status notifications.
+
+       <b>o</b>      If  the  template  message  text contains non-ASCII
+              characters, Postfix requires that the <b>Charset:</b> tem-
+              plate  header  is  updated.  Specify an appropriate
+              superset of US-ASCII.  A superset is needed because
+              Postfix  appends  ASCII text after the message tem-
+              plate when it sends a delivery status notification.
+
+<b>SEE ALSO</b>
+       <a href="bounce.8.html">bounce(8)</a>, Postfix delivery status notifications
+       <a href="postconf.5.html">postconf(5)</a>, configuration parameters
+
+<b>LICENSE</b>
+       The  Secure  Mailer  license must be distributed with this
+       software.
+
+<b>HISTORY</b>
+       The Postfix bounce template format was  originally  devel-
+       oped by Nicolas Riendeau.
+
+<b>AUTHOR(S)</b>
+       Wietse Venema
+       IBM T.J. Watson Research
+       P.O. Box 704
+       Yorktown Heights, NY 10598, USA
+
+                                                                     BOUNCE(5)
+</pre> </body> </html>
index 7fa0568034f8c5680e4666e938525c80afb0809b..b636478714c2c69cbe91a17eea32dfd24e4865a8 100644 (file)
@@ -7,19 +7,18 @@
 BOUNCE(8)                                                            BOUNCE(8)
 
 <b>NAME</b>
-       bounce - Postfix message bounce or defer daemon
+       bounce - Postfix delivery status reports
 
 <b>SYNOPSIS</b>
        <b>bounce</b> [generic Postfix daemon options]
 
 <b>DESCRIPTION</b>
        The  <a href="bounce.8.html"><b>bounce</b>(8)</a> daemon maintains per-message log files with
-       non-delivery status information. Each log  file  is  named
-       after  the  queue file that it corresponds to, and is kept
-       in a queue subdirectory named after the  service  name  in
-       the  <b>master.cf</b> file (either <b>bounce</b>, <b>defer</b> or <b>trace</b>).  This
-       program expects to be run from the <a href="master.8.html"><b>master</b>(8)</a> process  man-
-       ager.
+       delivery status information. Each log file is named  after
+       the  queue  file  that it corresponds to, and is kept in a
+       queue subdirectory named after the  service  name  in  the
+       <b>master.cf</b> file (either <b>bounce</b>, <b>defer</b> or <b>trace</b>).  This pro-
+       gram expects to be run from the <a href="master.8.html"><b>master</b>(8)</a> process manager.
 
        The  <a href="bounce.8.html"><b>bounce</b>(8)</a>  daemon  processes  two  types  of  service
        requests:
@@ -78,7 +77,7 @@ BOUNCE(8)                                                            BOUNCE(8)
               The maximal amount of original message text that is
               sent in a non-delivery notification.
 
-       <b>bounce_template_file (empty)</b>
+       <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a> (empty)</b>
               Pathname  of  a configuration file with bounce mes-
               sage templates.
 
@@ -152,6 +151,7 @@ BOUNCE(8)                                                            BOUNCE(8)
        /var/spool/postfix/trace/* delivery status records
 
 <b>SEE ALSO</b>
+       <a href="bounce.5.html">bounce(5)</a>, bounce message template format
        <a href="qmgr.8.html">qmgr(8)</a>, queue manager
        <a href="postconf.5.html">postconf(5)</a>, configuration parameters
        <a href="master.5.html">master(5)</a>, generic daemon options
index da2895a55fa93693bf602c46db436e2131432c7f..55d8c2cec458b3575cadd813764d3bb3abd67ddf 100644 (file)
@@ -14,14 +14,31 @@ POSTCONF(1)                                                        POSTCONF(1)
 
        <b>postconf</b> [<b>-ev</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter=value ...</i>]
 
+       <b>postconf</b> [<b>-btv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>template</i><b>_</b><i>file</i>]
+
 <b>DESCRIPTION</b>
-       The <a href="postconf.1.html"><b>postconf</b>(1)</a> command prints the actual value of <i>parame-</i>
-       <i>ter</i> (all known parameters by default)  one  parameter  per
-       line, changes its value, or prints other information about
+       The <a href="postconf.1.html"><b>postconf</b>(1)</a> command displays the actual values of con-
+       figuration  parameters,  changes  configuration  parameter
+       values,  or displays other configuration information about
        the Postfix mail system.
 
        Options:
 
+       <b>-b</b> [<i>template</i><b>_</b><i>file</i>]
+              Display the message text that appears at the begin-
+              ning  of  delivery  status  notification (DSN) mes-
+              sages, with $<b>name</b> expressions  replaced  by  actual
+              values.   To  override  the  built-in message text,
+              specify a template file at the end of  the  command
+              line,  or  specify  a template file in main.cf with
+              the  <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a></b>  parameter.    To   force
+              selection  of  the built-in message text templates,
+              specify an empty template file name (in shell  lan-
+              guage: "").
+
+              This  feature  is  available  with  Postfix 2.3 and
+              later.
+
        <b>-c</b> <i>config</i><b>_</b><i>dir</i>
               The <b>main.cf</b> configuration  file  is  in  the  named
               directory  instead  of  the  default  configuration
@@ -151,15 +168,27 @@ POSTCONF(1)                                                        POSTCONF(1)
                             is  a  group  file  entry in <b>group</b>(5)
                             format.
 
-       Other table types may exist depending on how  Postfix  was
-       built.
+              Other table types may exist depending on how  Post-
+              fix was built.
 
        <b>-n</b>     Print parameter settings that are not left at their
               built-in default value, because they are explicitly
               specified in main.cf.
 
+       <b>-t</b> [<i>template</i><b>_</b><i>file</i>]
+              Display the templates for delivery status notifica-
+              tion (DSN) messages. To override the built-in  tem-
+              plates,  specify  a template file at the end of the
+              command line, or specify a template file in main.cf
+              with  the <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a></b> parameter.  To force
+              selection of the  built-in  templates,  specify  an
+              empty template file name (in shell language: "").
+
+              This  feature  is  available  with  Postfix 2.3 and
+              later.
+
        <b>-v</b>     Enable verbose logging for debugging purposes. Mul-
-              tiple <b>-v</b> options  make  the  software  increasingly
+              tiple  <b>-v</b>  options  make  the software increasingly
               verbose.
 
 <b>DIAGNOSTICS</b>
@@ -170,20 +199,25 @@ POSTCONF(1)                                                        POSTCONF(1)
               Directory with Postfix configuration files.
 
 <b>CONFIGURATION PARAMETERS</b>
-       The  following  <b>main.cf</b> parameters are especially relevant
+       The following <b>main.cf</b> parameters are  especially  relevant
        to this program.
 
-       The text below provides  only  a  parameter  summary.  See
+       The  text  below  provides  only  a parameter summary. See
        <a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including examples.
 
        <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
-              The  default  location  of  the Postfix main.cf and
+              The default location of  the  Postfix  main.cf  and
               master.cf configuration files.
 
+       <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a> (empty)</b>
+              Pathname  of  a configuration file with bounce mes-
+              sage templates.
+
 <b>FILES</b>
        /etc/postfix/main.cf, Postfix configuration parameters
 
 <b>SEE ALSO</b>
+       <a href="bounce.5.html">bounce(5)</a>, bouce template file format
        <a href="postconf.5.html">postconf(5)</a>, configuration parameters
 
 <b>README FILES</b>
index 1d721f5397f0cf62bc7887aef13767c7c42dccc0..d3ff4cfdf67d1dc0c7418b413faf0d854848cb5f 100644 (file)
@@ -1108,7 +1108,15 @@ proportionally.  </p>
 (default: empty)</b></DT><DD>
 
 <p> Pathname of a configuration file with bounce message templates.
-</p>
+These override the <a href="bounce.8.html">bounce(8)</a> server built-in templates of delivery
+status notification (DSN) messages for undeliverable mail, for
+delayed mail, for successful delivery, or for mail delivery
+verification. </p>
+
+<p> Template message body text may contain $name references to
+Postfix configuration parameters. The result of $name expansion can
+be previewed with "<b>postconf -b <i>file_name</i></b>" before the file
+is placed into the Postfix configuration directory.  </p>
 
 <p> This feature is available in Postfix 2.3 and later.  </p>
 
index 042ee6502ddd36d5025db9e167eead3bc6725ffc..ed013d06f3b9a5aff3cc4f085e6e35892bc68594 100644 (file)
@@ -111,6 +111,8 @@ the following convention:  </p>
 <ul>
 
 
+<li> <a href="bounce.5.html">bounce(5)</a>, Postfix bounce message templates 
+
 <li> <a href="master.5.html">master(5)</a>, Postfix master.cf file syntax 
 
 <li> <a href="postconf.5.html">postconf(5)</a>, Postfix main.cf file syntax 
index 5631721ff125c1b0c2c90a8900b34099148ab320..7dbcdf40fa49f86ee68b9db2973c95f994714929 100644 (file)
@@ -213,6 +213,7 @@ POSTFIX(1)                                                          POSTFIX(1)
        <a href="sendmail.1.html">sendmail(1)</a>, Sendmail compatibility interface
 
        Postfix configuration:
+       <a href="bounce.5.html">bounce(5)</a>, Postfix bounce message templates
        <a href="master.5.html">master(5)</a>, Postfix master.cf file syntax
        <a href="postconf.5.html">postconf(5)</a>, Postfix main.cf file syntax
 
index c860e8e74521ed6249c683e51999c2b2d39c6c97..e81c333bcd53455208b56e18b10fbdef9cabbc7b 100644 (file)
@@ -17,7 +17,7 @@ CONFIG        = man5/access.5 man5/aliases.5 man5/canonical.5 man5/relocated.5 \
        man5/cidr_table.5 man5/tcp_table.5 man5/header_checks.5 \
        man5/body_checks.5 man5/ldap_table.5 man5/mysql_table.5 \
        man5/pgsql_table.5 man5/master.5 man5/nisplus_table.5 \
-       man5/generic.5
+       man5/generic.5 man5/bounce.5
 TOOLS  = man1/smtp-sink.1 man1/smtp-source.1 man1/qmqp-sink.1 \
        man1/qmqp-source.1 man1/qshape.1
 
@@ -235,6 +235,9 @@ man5/access.5: ../proto/access
 man5/aliases.5: ../proto/aliases
        ../mantools/srctoman - $? >$@
 
+man5/bounce.5: ../proto/bounce
+       ../mantools/srctoman - $? >$@
+
 man5/canonical.5: ../proto/canonical
        ../mantools/srctoman - $? >$@
 
index 95e6cfd75ca449803d03b668cf16da2ec6ded8d4..ee179c3bece7b8d4a3f35a70fc702b7dd743989d 100644 (file)
@@ -14,15 +14,28 @@ Postfix configuration utility
 
 \fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
 [\fIparameter=value ...\fR]
+
+\fBpostconf\fR [\fB-btv\fR] [\fB-c \fIconfig_dir\fR] [\fItemplate_file\fR]
 .SH DESCRIPTION
 .ad
 .fi
-The \fBpostconf\fR(1) command prints the actual value of
-\fIparameter\fR (all known parameters by default) one
-parameter per line, changes its value, or prints other
-information about the Postfix mail system.
+The \fBpostconf\fR(1) command displays the actual values
+of configuration parameters, changes configuration parameter
+values, or displays other configuration information about
+the Postfix mail system.
 
 Options:
+.IP "\fB-b\fR [\fItemplate_file\fR]"
+Display the message text that appears at the beginning of
+delivery status notification (DSN) messages, with $\fBname\fR
+expressions replaced by actual values.  To override the
+built-in message text, specify a template file at the end
+of the command line, or specify a template file in main.cf
+with the \fBbounce_template_file\fR parameter.
+To force selection of the built-in message text templates,
+specify an empty template file name (in shell language: "").
+
+This feature is available with Postfix 2.3 and later.
 .IP "\fB-c \fIconfig_dir\fR"
 The \fBmain.cf\fR configuration file is in the named directory
 instead of the default configuration directory.
@@ -123,11 +136,21 @@ The table is the UNIX group database. The key is a group name.
 The result is a group file entry in \fBgroup\fR(5) format.
 .RE
 .RE
-.sp
+.IP
 Other table types may exist depending on how Postfix was built.
 .IP \fB-n\fR
 Print parameter settings that are not left at their built-in
 default value, because they are explicitly specified in main.cf.
+.IP "\fB-t\fR [\fItemplate_file\fR]"
+Display the templates for delivery status notification (DSN)
+messages. To override the built-in templates, specify a
+template file at the end of the command line, or specify a
+template file in main.cf with the \fBbounce_template_file\fR
+parameter.  To force selection of the built-in templates,
+specify an empty template file name (in shell language:
+"").
+
+This feature is available with Postfix 2.3 and later.
 .IP \fB-v\fR
 Enable verbose logging for debugging purposes. Multiple \fB-v\fR
 options make the software increasingly verbose.
@@ -155,6 +178,8 @@ The text below provides only a parameter summary. See
 .IP "\fBconfig_directory (see 'postconf -d' output)\fR"
 The default location of the Postfix main.cf and master.cf
 configuration files.
+.IP "\fBbounce_template_file (empty)\fR"
+Pathname of a configuration file with bounce message templates.
 .SH "FILES"
 .na
 .nf
@@ -162,6 +187,7 @@ configuration files.
 .SH "SEE ALSO"
 .na
 .nf
+bounce(5), bouce template file format
 postconf(5), configuration parameters
 .SH "README FILES"
 .na
index 4b9b95ebc542231d2f262a1e08c132af3d78c428..80c23e5a386d3a4e8afbe00b96311d2480d15541 100644 (file)
@@ -179,6 +179,7 @@ newaliases(1), Sendmail compatibility interface
 sendmail(1), Sendmail compatibility interface
 
 Postfix configuration:
+bounce(5), Postfix bounce message templates
 master(5), Postfix master.cf file syntax
 postconf(5), Postfix main.cf file syntax
 
diff --git a/postfix/man/man5/bounce.5 b/postfix/man/man5/bounce.5
new file mode 100644 (file)
index 0000000..2c79479
--- /dev/null
@@ -0,0 +1,210 @@
+.TH BOUNCE 5 
+.ad
+.fi
+.SH NAME
+bounce
+\-
+Postfix bounce message template format
+.SH "SYNOPSIS"
+.na
+.nf
+\fBbounce_template_file = /etc/postfix/bounce.cf\fR
+
+\fBpostconf -b\fR [\fItemplate_file\fR]
+.SH DESCRIPTION
+.ad
+.fi
+The Postfix \fBbounce\fR(8) server produces delivery status
+notification (DSN) messages for undeliverable mail, delayed
+mail, successful delivery or address verification requests.
+
+By default, these notifications are generated from built-in
+templates with message headers and message text. Sites can
+override the built-in information by specifying a bounce
+template file with the \fBbounce_template_file\fR configuration
+parameter.
+
+This document describes the general procedure to create a
+bounce template file, followed by the specific details of
+bounce template formats.
+.SH "GENERAL PROCEDURE"
+.na
+.nf
+.ad
+.fi
+To create customized bounce template file, create a temporary
+copy of the file \fB/etc/postfix/bounce.cf.default\fR and
+edit the temporary file.
+
+To preview the results of $\fIname\fR expansions in the
+template text, use the command
+
+.ti +4
+\fBpostconf -b\fR \fItemporary_file\fR
+
+Errors in the template will be reported to the standard
+error stream and to the syslog daemon.
+
+While previewing the text, be sure to pay particular attention
+to the expansion of time value parameters that appear in
+the delayed mail notification text.
+
+Once the result is satisfactory, copy the template to the
+Postfix configuration directory and specify in main.cf
+something like:
+
+/etc/postfix/main.cf:
+.ti +4
+    bounce_template_file = /etc/postfix/bounce.cf
+.SH "TEMPLATE FILE FORMAT"
+.na
+.nf
+.ad
+.fi
+The template file can specify templates for failed mail,
+delayed mail, successful delivery or for address verification.
+These templates are named \fBfailure_template\fR,
+\fBdelay_template\fR, \fBsuccess_template\fR and
+\fBverify_template\fR, respectively.  You can but do not
+have to specify all four templates in a bounce template
+file.
+
+Each template starts with "\fItemplate_name\fB = <<EOF\fR"
+and ends with a line that contains the word "\fBEOF\fR"
+only. You can change the word EOF, but you can't enclose
+it in quotes as with the shell or with Perl (\fItemplate_name\fB
+= <<'EOF'\fR). Here is an example:
+
+.in +2
+.nf
+.na
+# The failure template is used for undeliverable mail.
+
+failure_template = <<EOF
+Charset: us-ascii
+From: MAILER-DAEMON (Mail Delivery System)
+Subject: Undelivered Mail Returned to Sender
+Postmaster-Subject: Postmaster Copy: Undelivered Mail
+
+This is the $mail_name program at host $myhostname.
+
+I'm sorry to have to inform you that your message could not
+be delivered to one or more recipients. It's attached below.
+
+For further assistance, please send mail to <postmaster>
+
+If you do so, please include this problem report. You can
+delete your own text from the attached returned message.
+
+.ti +12
+                   The $mail_name program
+EOF
+.in -2
+.ad
+.fi
+
+No special meaning is given to the backslash character or
+to leading whitespace; these are always taken literally.
+
+Outside the << context, lines beginning with "#" are ignored,
+as are empty lines, and lines consisting of whitespace only.
+
+Examples of all templates can be found in the file
+\fBbounce.cf.default\fR in the Postfix configuration
+directory.
+.SH "TEMPLATE HEADER FORMAT"
+.na
+.nf
+.ad
+.fi
+The first portion of a bounce template consists of optional
+template headers.  These either become message headers in
+the delivery status notification, or control the formatting
+of the notification. Headers not specified in a template
+will be left at their default value.
+
+The following headers are supported:
+.IP \fBCharset:\fR
+The MIME character set of the template message text.  See
+the "TEMPLATE MESSAGE TEXT FORMAT" description below.
+.IP \fBFrom:\fR
+The sender address that the recipient will see.
+.IP \fBSubject:\fR
+The subject that the recipient will see.
+.IP \fBPostmaster-Subject:\fR
+The subject that will be used in Postmaster copies of
+undeliverable or delayed mail notifications. These copies
+are sent under control of the notify_classes configuration
+parameter.
+.PP
+The usage and specification of template message headers is
+subject to the following restrictions:
+.IP \(bu
+Template message header names can be specified in upper
+case, lower case or mixed case. Postfix always uses the
+spelling as shown in the example above.
+.IP \(bu
+Template message headers must not span multiple lines.
+.IP \(bu
+Template message headers must not contain main.cf $parameters.
+.IP \(bu
+Template message headers must contain ASCII characters only.
+.SH "TEMPLATE MESSAGE TEXT FORMAT"
+.na
+.nf
+.ad
+.fi
+The second portion of a bounce template consists of message
+text. As the above example shows, template message text may
+contain main.cf $parameters. Besides the parameters that are
+defined in main.cf, the following parameters are treated
+specially depending on the suffix that is appended to their
+name.
+.IP \fBdelay_warning_time_\fIsuffix\fR
+Expands into the value of the \fBdelay_warning_time\fR
+parameter, expressed in the time unit specified by
+\fIsuffix\fR, which is one of \fBseconds\fR, \fBminutes\fR,
+\fBhours\fB, \fBdays\fR, or \fBweeks\fR.
+.IP \fBmaximal_queue_lifetime_\fIsuffix\fR
+Expands into the value of the \fBmaximal_queue_lifetime\fR
+parameter, expressed in the time unit specified by
+\fIsuffix\fR.  See above under \fBdelay_warning_time\fR for
+possible \fIsuffix\fR values.
+.PP
+The usage and specification of template message text is
+subject to the following restrictions:
+.IP \(bu
+The template message text is not sent in Postmaster copies
+of delivery status notifications.
+.IP \(bu
+If the template message text contains non-ASCII characters,
+Postfix requires that the \fBCharset:\fR template header
+is updated.  Specify an appropriate superset of US-ASCII.
+A superset is needed because Postfix appends ASCII text
+after the message template when it sends a delivery status
+notification.
+.SH "SEE ALSO"
+.na
+.nf
+bounce(8), Postfix delivery status notifications
+postconf(5), configuration parameters
+.SH "LICENSE"
+.na
+.nf
+.ad
+.fi
+The Secure Mailer license must be distributed with this software.
+.SH "HISTORY"
+.na
+.nf
+.ad
+.fi
+The Postfix bounce template format was originally developed by
+Nicolas Riendeau.
+.SH "AUTHOR(S)"
+.na
+.nf
+Wietse Venema
+IBM T.J. Watson Research
+P.O. Box 704
+Yorktown Heights, NY 10598, USA
index fcc3accaa28e7ecac43a6cbe4f5c3b9ca3105bf3..e8d4599febaa8371499ae8a9e135ef70c763e834 100644 (file)
@@ -601,6 +601,15 @@ this limit, then you should increase the mime_nesting_limit value
 proportionally.
 .SH bounce_template_file (default: empty)
 Pathname of a configuration file with bounce message templates.
+These override the \fBbounce\fR(8) server built-in templates of delivery
+status notification (DSN) messages for undeliverable mail, for
+delayed mail, for successful delivery, or for mail delivery
+verification.
+.PP
+Template message body text may contain $name references to
+Postfix configuration parameters. The result of $name expansion can
+be previewed with "\fBpostconf -b \fIfile_name\fR\fR" before the file
+is placed into the Postfix configuration directory.
 .PP
 This feature is available in Postfix 2.3 and later.
 .SH broken_sasl_auth_clients (default: no)
index de843697f1480151e452362e61a7ce3492143803..8d5d0e30c76b87e0346d591393eebf807b463882 100644 (file)
@@ -4,7 +4,7 @@
 .SH NAME
 bounce
 \-
-Postfix message bounce or defer daemon
+Postfix delivery status reports
 .SH "SYNOPSIS"
 .na
 .nf
@@ -13,7 +13,7 @@ Postfix message bounce or defer daemon
 .ad
 .fi
 The \fBbounce\fR(8) daemon maintains per-message log files with
-non-delivery status information. Each log file is named after the
+delivery status information. Each log file is named after the
 queue file that it corresponds to, and is kept in a queue subdirectory
 named after the service name in the \fBmaster.cf\fR file (either
 \fBbounce\fR, \fBdefer\fR or \fBtrace\fR).
@@ -125,6 +125,7 @@ records, so that "smtpd" becomes, for example, "postfix/smtpd".
 .SH "SEE ALSO"
 .na
 .nf
+bounce(5), bounce message template format
 qmgr(8), queue manager
 postconf(5), configuration parameters
 master(5), generic daemon options
index f2a655a7172544c7f2b7f547167dc0362b078a52..b441fa0b6bdf9f9b704ab06c7fe507ae9d0e0ef8 100755 (executable)
@@ -106,6 +106,7 @@ while (<>) {
     s;\bbounce_queue_lifetime\b;<a href="postconf.5.html#bounce_queue_lifetime">$&</a>;g;
     s;\bbounce_service_name\b;<a href="postconf.5.html#bounce_service_name">$&</a>;g;
     s;\bbounce_size_limit\b;<a href="postconf.5.html#bounce_size_limit">$&</a>;g;
+    s;\bbounce_template_file\b;<a href="postconf.5.html#bounce_template_file">$&</a>;g;
     s;\bbroken_sasl_auth_clients\b;<a href="postconf.5.html#broken_sasl_auth_clients">$&</a>;g;
     s;\bcanonical_classes\b;<a href="postconf.5.html#canonical_classes">$&</a>;g;
     s;\bcanonical_maps\b;<a href="postconf.5.html#canonical_maps">$&</a>;g;
@@ -141,7 +142,7 @@ while (<>) {
     s;\bdefer_transports\b;<a href="postconf.5.html#defer_transports">$&</a>;g;
     s;\bdelay_logging_resolution_limit\b;<a href="postconf.5.html#delay_logging_resolution_limit">$&</a>;g;
     s;\bdelay_notice_recip[-</bB>]*\n* *[<bB>]*ient\b;<a href="postconf.5.html#delay_notice_recipient">$&</a>;g;
-    s;\bdelay_warning_time\b;<a href="postconf.5.html#delay_warning_time">$&</a>;g;
+    s;\bdelay_warn[-</bB>]*\n*[ <bB>]*ing_time\b;<a href="postconf.5.html#delay_warning_time">$&</a>;g;
     s;\bdeliver_lock_attempts\b;<a href="postconf.5.html#deliver_lock_attempts">$&</a>;g;
     s;\bdeliver_lock_delay\b;<a href="postconf.5.html#deliver_lock_delay">$&</a>;g;
     s;\bdisable_dns_lookups\b;<a href="postconf.5.html#disable_dns_lookups">$&</a>;g;
@@ -234,7 +235,7 @@ while (<>) {
     s;\bmax_idle\b;<a href="postconf.5.html#max_idle">$&</a>;g;
     s;\bmax_use\b;<a href="postconf.5.html#max_use">$&</a>;g;
     s;\bmaxi[-</bB>]*\n*[ <bB>]*mal_backoff_time\b;<a href="postconf.5.html#maximal_backoff_time">$&</a>;g;
-    s;\bmaxi[-</bB>]*\n*[ <bB>]*mal_queue_lifetime\b;<a href="postconf.5.html#maximal_queue_lifetime">$&</a>;g;
+    s;\bmaxi[-</bB>]*\n*[ <bB>]*mal_queue_life[-</bB>]*\n*[ <bB>]*time\b;<a href="postconf.5.html#maximal_queue_lifetime">$&</a>;g;
     s;\bmessage_reject_characters\b;<a href="postconf.5.html#message_reject_characters">$&</a>;g;
     s;\bmessage_size_limit\b;<a href="postconf.5.html#message_size_limit">$&</a>;g;
     s;\bmessage_strip_characters\b;<a href="postconf.5.html#message_strip_characters">$&</a>;g;
@@ -544,7 +545,7 @@ while (<>) {
     s/[<bB>]*newaliases[<\/bB>]*\(1\)/<a href="newaliases.1.html">$&<\/a>/g;
     s/[<bB>]*postalias[<\/bB>]*\(1\)/<a href="postalias.1.html">$&<\/a>/g;
     s/[<bB>]*postcat[<\/bB>]*\(1\)/<a href="postcat.1.html">$&<\/a>/g;
-    s/[<bB>]*postconf[<\/bB>]*\(1\)/<a href="postconf.1.html">$&<\/a>/g;
+    s/[<bB>]*post[-<\/bB>]*\n*[ <bB>]*conf[<\/bB>]*\(1\)/<a href="postconf.1.html">$&<\/a>/g;
     s/[<bB>]*postdrop[<\/bB>]*\(1\)/<a href="postdrop.1.html">$&<\/a>/g;
     s/[<bB>]*postfix[<\/bB>]*\(1\)/<a href="postfix.1.html">$&<\/a>/g;
     s/[<bB>]*postkick[<\/bB>]*\(1\)/<a href="postkick.1.html">$&<\/a>/g;
@@ -561,6 +562,7 @@ while (<>) {
     s/[<bB>]*qshape[<\/bB>]*\(1\)/<a href="qshape.1.html">$&<\/a>/g;
     s/[<bB>]*access[<\/bB>]*\(5\)/<a href="access.5.html">$&<\/a>/g;
     s/[<bB>]*aliases[<\/bB>]*\(5\)/<a href="aliases.5.html">$&<\/a>/g;
+    s/[<bB>]*bounce[<\/bB>]*\(5\)/<a href="bounce.5.html">$&<\/a>/g;
     s/[<bB>]*canonical[<\/bB>]*\(5\)/<a href="canonical.5.html">$&<\/a>/g;
     s/[<bB>]*gener[-<\/bB>]*\n* *[<bB>]*ic[<\/bB>]*\(5\)/<a href="generic.5.html">$&<\/a>/g;
     s/[<bB>]*ldap[<\/bBiI>]*_[<\/iIbB>]*ta[-<\/bB>]*\n*[ <bB>]*ble[<\/bB>]*\(5\)/<a href="ldap_table.5.html">$&<\/a>/g;
diff --git a/postfix/proto/bounce b/postfix/proto/bounce
new file mode 100644 (file)
index 0000000..bd80b7b
--- /dev/null
@@ -0,0 +1,189 @@
+#++
+# NAME
+#      bounce 5
+# SUMMARY
+#      Postfix bounce message template format
+# SYNOPSIS
+#      \fBbounce_template_file = /etc/postfix/bounce.cf\fR
+#
+#      \fBpostconf -b\fR [\fItemplate_file\fR]
+# DESCRIPTION
+#      The Postfix \fBbounce\fR(8) server produces delivery status
+#      notification (DSN) messages for undeliverable mail, delayed
+#      mail, successful delivery or address verification requests.
+#
+#      By default, these notifications are generated from built-in
+#      templates with message headers and message text. Sites can
+#      override the built-in information by specifying a bounce
+#      template file with the \fBbounce_template_file\fR configuration
+#      parameter.
+#
+#      This document describes the general procedure to create a
+#      bounce template file, followed by the specific details of
+#      bounce template formats.
+# GENERAL PROCEDURE
+# .ad
+# .fi
+#      To create customized bounce template file, create a temporary
+#      copy of the file \fB/etc/postfix/bounce.cf.default\fR and
+#      edit the temporary file.
+#
+#      To preview the results of $\fIname\fR expansions in the
+#       template text, use the command
+#
+# .ti +4
+#      \fBpostconf -b\fR \fItemporary_file\fR
+#
+#      Errors in the template will be reported to the standard
+#      error stream and to the syslog daemon.
+#
+#      While previewing the text, be sure to pay particular attention
+#      to the expansion of time value parameters that appear in
+#      the delayed mail notification text.
+#
+#      Once the result is satisfactory, copy the template to the
+#      Postfix configuration directory and specify in main.cf
+#      something like:
+#
+#      /etc/postfix/main.cf:
+# .ti +4
+#          bounce_template_file = /etc/postfix/bounce.cf
+# TEMPLATE FILE FORMAT
+# .ad
+# .fi
+#      The template file can specify templates for failed mail,
+#      delayed mail, successful delivery or for address verification.
+#      These templates are named \fBfailure_template\fR,
+#      \fBdelay_template\fR, \fBsuccess_template\fR and
+#      \fBverify_template\fR, respectively.  You can but do not
+#      have to specify all four templates in a bounce template
+#      file.
+#
+#      Each template starts with "\fItemplate_name\fB = <<EOF\fR"
+#      and ends with a line that contains the word "\fBEOF\fR"
+#      only. You can change the word EOF, but you can't enclose
+#      it in quotes as with the shell or with Perl (\fItemplate_name\fB
+#      = <<'EOF'\fR). Here is an example:
+#
+# .in +2
+# .nf
+# .na
+#      # The failure template is used for undeliverable mail.
+#
+#      failure_template = <<EOF
+#      Charset: us-ascii
+#      From: MAILER-DAEMON (Mail Delivery System)
+#      Subject: Undelivered Mail Returned to Sender
+#      Postmaster-Subject: Postmaster Copy: Undelivered Mail
+#      
+#      This is the $mail_name program at host $myhostname.
+#      
+#      I'm sorry to have to inform you that your message could not
+#      be delivered to one or more recipients. It's attached below.
+#      
+#      For further assistance, please send mail to <postmaster>
+#      
+#      If you do so, please include this problem report. You can
+#      delete your own text from the attached returned message.
+#
+# .ti +12
+#                         The $mail_name program
+#      EOF
+# .in -2
+# .ad
+# .fi
+#
+#      No special meaning is given to the backslash character or
+#      to leading whitespace; these are always taken literally.
+#
+#      Outside the << context, lines beginning with "#" are ignored,
+#      as are empty lines, and lines consisting of whitespace only.
+#
+#      Examples of all templates can be found in the file
+#      \fBbounce.cf.default\fR in the Postfix configuration
+#      directory.
+# TEMPLATE HEADER FORMAT
+# .ad
+# .fi
+#      The first portion of a bounce template consists of optional
+#      template headers.  These either become message headers in
+#      the delivery status notification, or control the formatting
+#      of the notification. Headers not specified in a template
+#      will be left at their default value.
+#
+#      The following headers are supported:
+# .IP \fBCharset:\fR
+#      The MIME character set of the template message text.  See
+#      the "TEMPLATE MESSAGE TEXT FORMAT" description below.
+# .IP \fBFrom:\fR
+#      The sender address that the recipient will see.
+# .IP \fBSubject:\fR
+#      The subject that the recipient will see.
+# .IP \fBPostmaster-Subject:\fR
+#      The subject that will be used in Postmaster copies of
+#      undeliverable or delayed mail notifications. These copies
+#      are sent under control of the notify_classes configuration
+#      parameter.
+# .PP
+#      The usage and specification of template message headers is
+#      subject to the following restrictions:
+# .IP \(bu
+#      Template message header names can be specified in upper
+#      case, lower case or mixed case. Postfix always uses the
+#      spelling as shown in the example above.
+# .IP \(bu
+#      Template message headers must not span multiple lines.
+# .IP \(bu
+#      Template message headers must not contain main.cf $parameters.
+# .IP \(bu
+#      Template message headers must contain ASCII characters only.
+# TEMPLATE MESSAGE TEXT FORMAT
+# .ad
+# .fi
+#      The second portion of a bounce template consists of message
+#      text. As the above example shows, template message text may
+#      contain main.cf $parameters. Besides the parameters that are
+#      defined in main.cf, the following parameters are treated
+#      specially depending on the suffix that is appended to their
+#      name.
+# .IP \fBdelay_warning_time_\fIsuffix\fR
+#      Expands into the value of the \fBdelay_warning_time\fR
+#      parameter, expressed in the time unit specified by
+#      \fIsuffix\fR, which is one of \fBseconds\fR, \fBminutes\fR,
+#      \fBhours\fB, \fBdays\fR, or \fBweeks\fR.
+# .IP \fBmaximal_queue_lifetime_\fIsuffix\fR
+#      Expands into the value of the \fBmaximal_queue_lifetime\fR
+#      parameter, expressed in the time unit specified by
+#      \fIsuffix\fR.  See above under \fBdelay_warning_time\fR for
+#      possible \fIsuffix\fR values.
+# .PP
+#      The usage and specification of template message text is
+#      subject to the following restrictions:
+# .IP \(bu
+#      The template message text is not sent in Postmaster copies
+#      of delivery status notifications.
+# .IP \(bu
+#      If the template message text contains non-ASCII characters,
+#      Postfix requires that the \fBCharset:\fR template header
+#      is updated.  Specify an appropriate superset of US-ASCII.
+#      A superset is needed because Postfix appends ASCII text
+#      after the message template when it sends a delivery status
+#      notification.
+# SEE ALSO
+#      bounce(8), Postfix delivery status notifications
+#      postconf(5), configuration parameters
+# LICENSE
+# .ad
+# .fi
+#      The Secure Mailer license must be distributed with this software.
+# HISTORY
+# .ad
+# .fi
+#      The Postfix bounce template format was originally developed by
+#      Nicolas Riendeau.
+# AUTHOR(S)
+#      Wietse Venema
+#      IBM T.J. Watson Research
+#      P.O. Box 704
+#      Yorktown Heights, NY 10598, USA
+#--
index 80119f197e4889b5f1ba15d79755772ebcb8ff19..b9b29e345092ca7188bbfd9cc1edd601f369c600 100644 (file)
@@ -8679,7 +8679,15 @@ precision.  </p>
 %PARAM bounce_template_file empty
 
 <p> Pathname of a configuration file with bounce message templates.
-</p>
+These override the bounce(8) server built-in templates of delivery
+status notification (DSN) messages for undeliverable mail, for
+delayed mail, for successful delivery, or for mail delivery
+verification. </p>
+
+<p> Template message body text may contain $name references to
+Postfix configuration parameters. The result of $name expansion can
+be previewed with "<b>postconf -b <i>file_name</i></b>" before the file
+is placed into the Postfix configuration directory.  </p>
 
 <p> This feature is available in Postfix 2.3 and later.  </p>
 
index f6f3c614157ab8ca486985d452238b73ef03dbfd..4a1edaae156f4edd8480ad1ec6c5ea1c8639ba6a 100644 (file)
@@ -22,9 +22,12 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
 $(PROG):       $(OBJS) $(LIBS)
        $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
-../../conf/bounce.cf.default: $(PROG) fix-template.pl
+# Avoid dependency on installed Postfix.
+../../conf/bounce.cf.default: $(PROG) annotate.pl
        rm -f $@
-       ./$(PROG) -Szn default | perl fix-template.pl >$@
+       echo queue_directory=. >main.cf
+       MAIL_CONFIG=. ./$(PROG) -SVzndump_templates | perl annotate.pl >$@
+       rm -f main.cf
 
 $(OBJS): ../../conf/makedefs.out
 
@@ -52,15 +55,18 @@ lint:
        lint $(DEFS) $(SRCS) $(LINTFIX)
 
 clean:
-       rm -f *.o *core $(PROG) $(TESTPROG) junk 
+       rm -f *.o *core $(PROG) $(TESTPROG) junk main.cf
        rm -rf printfck
 
 tidy:  clean
 
-template_test:
-       ./bounce -Szn default >junk
-       ./bounce -Szn actual -o bounce_template_file=`pwd`/junk | diff junk -
-       rm -f junk
+# Avoid dependency on installed Postfix.
+template_test: $(PROG)
+       echo queue_directory=. >main.cf
+       MAIL_CONFIG=. ./$(PROG) -SVzndump_templates >junk
+       MAIL_CONFIG=. ./$(PROG) -SVzndump_templates \
+           -o bounce_template_file=junk | diff junk -
+       rm -f junk main.cf
 
 depend: $(MAKES)
        (sed '1,/^# do not edit/!d' Makefile.in; \
similarity index 56%
rename from postfix/src/bounce/fix-template.pl
rename to postfix/src/bounce/annotate.pl
index 5d0dde5cada421c7863f2446a470e58ac3ac9d81..a7aabfe677a63748449d548679f0051649ab40ca 100644 (file)
@@ -4,51 +4,69 @@ print <<'EOF'
 # notification (DSN) messages that are built into Postfix.
 #
 # To change Postfix DSN messages, perhaps to add non-English text,
-# follow instructions in the BOUNCE_README document.
+# follow instructions in the bounce(5) manual page.
 #
+EOF
+
 # QUICK INSTRUCTIONS:
 #
-# Copy this file to $config_directory/bounce.cf, edit that file,
-# then specify in main.cf:
-#
-#      bounce_template_file = $config_directory/bounce.cf
+#-Edit a temporary copy of this file, and preview the result of $name
+# expansions with "postconf -b temporary_file". If there are any
+# problems, Postfix will log "warning" or "fatal" messages to the
+# maillog file.
 #
 #-The template file can specify bounce message templates for
-# failed mail, delayed mail, successful delivery, and verbose delivery.
-# You don't have to specify templates for all of these. If there is
-# anything about a template that Postfix does not like it logs a
-# warning and keeps using its built-in template.
+# failed mail, for delayed mail, for successful delivery, or for
+# verbose delivery.  You don't have to specify all templates.
+#
+#-Each template starts with "template_name = <<EOF" and ends
+# with a line that contains the word "EOF" only. You can change the
+# word EOF if you like, but you can't do shell/perl/etc like things
+# such as enclosing it in quotes (template_name = <<'EOF').
 #
 #-Each template consists of a few headers and message text. The
 # headers control what the recipient sees as From: and Subject:, and
-# what MIME information Postfix will generate. The message text is
-# not sent in Postmaster copies of delivery status notifications.
+# what MIME information Postfix will generate.
 #
-#-You can specify main.cf parameters in a template message text.
-# Some parameters have additional features as described below.
+#-Template message headers must not span multiple lines.
 #
-#-You cannot specify main.cf parameters in template headers.
+#-Template message headers must not contain main.cf $parameters.
 #
-#-Each template starts with "template_name = <<EOF" and ends
-# with a line that contains the word "EOF" only. You can change the
-# word EOF if you like, but you can't do shell/perl/etc like things
-# such as enclosing it in quotes (template_name = <<'EOF').
+#-Template message headers must contain ASCII characters only.
+#
+#-The template message text is not sent in Postmaster copies of
+# delivery status notifications.
 #
-# IMPORTANT:
+#-Template message text may contain main.cf $parameters. Some
+# parameters have additional features as described below with the
+# delayed mail message template.
 #
-# If you add non-ASCII text then you MUST change the CHARSET: value,
+#-Template message text may contain non-ASCII text. In that case you
+# MUST change the character set value in the CHARSET: template header,
 # otherwise Postfix will not use your template. You must specify a
 # character set that is a superset of US-ASCII, because Postfix
-# appends ASCII text after the message template.
+# appends ASCII text after the message template when it sends a
+# delivery status notification.
 #
-EOF
+#-When previewing the result with "postconf -b temporary_file", be
+# sure to pay particular attention to the time values that appear
+# in the delayed mail notification text.
+#
+#-Once you're satisfied with the result, and once Postfix stops
+# logging warning messages, copy the template to the Postfix
+# configuration directory and specify in main.cf something like:
+#
+# /etc/postfix/main.cf:
+#     bounce_template_file = $config_directory/bounce.cf
+#
+#EOF
 ;
 
 while (<>) {
-    if (/^fail_template/) { print <<'EOF'
+    if (/^failure_template/) { print <<'EOF'
 
 #
-# The fail template is used when mail is returned to the sender;
+# The failure template is used when mail is returned to the sender;
 # either the destination rejected the message, or the destination
 # could not be reached before the message expired in the queue.
 #
index de4219a0631fe9c6dc6e54d1e5be1ea0473bba3e..76f410b1991242e85d727b68ce8ddc8d51a50194 100644 (file)
@@ -2,12 +2,12 @@
 /* NAME
 /*     bounce 8
 /* SUMMARY
-/*     Postfix message bounce or defer daemon
+/*     Postfix delivery status reports
 /* SYNOPSIS
 /*     \fBbounce\fR [generic Postfix daemon options]
 /* DESCRIPTION
 /*     The \fBbounce\fR(8) daemon maintains per-message log files with
-/*     non-delivery status information. Each log file is named after the
+/*     delivery status information. Each log file is named after the
 /*     queue file that it corresponds to, and is kept in a queue subdirectory
 /*     named after the service name in the \fBmaster.cf\fR file (either
 /*     \fBbounce\fR, \fBdefer\fR or \fBtrace\fR).
 /*     /var/spool/postfix/defer/* non-delivery records
 /*     /var/spool/postfix/trace/* delivery status records
 /* SEE ALSO
+/*     bounce(5), bounce message template format
 /*     qmgr(8), queue manager
 /*     postconf(5), configuration parameters
 /*     master(5), generic daemon options
 
 #include <sys_defs.h>
 #include <string.h>
+#include <stdlib.h>
 
 #ifdef STRCASECMP_IN_STRINGS_H
 #include <strings.h>
@@ -444,16 +446,6 @@ static void bounce_service(VSTREAM *client, char *service_name, char **argv)
     if (mail_queue_name_ok(service_name) == 0)
        msg_fatal("malformed service name: %s", service_name);
 
-    /*
-     * Special case: dump the built-in templates. This is not part of the
-     * public interface.
-     */
-    if (strcmp(service_name, "default") == 0) {
-       bounce_template_dump_default(VSTREAM_OUT);
-       vstream_fflush(VSTREAM_OUT);
-       exit(0);
-    }
-
     /*
      * Read and validate the first parameter of the client request. Let the
      * request-specific protocol routines take care of the remainder.
@@ -516,11 +508,16 @@ static void pre_jail_init(char *service_name, char **unused_argv)
        bounce_template_load(var_bounce_tmpl);
 
     /*
-     * Special case: dump the actual templates. This is not part of the
-     * public interface.
+     * Special case: dump bounce templates. This is not part of the
+     * master(5) public interface.
      */
-    if (strcmp(service_name, "actual") == 0) {
-       bounce_template_dump_actual(VSTREAM_OUT);
+    if (strcmp(service_name, "dump_templates") == 0) {
+       bounce_template_dump_all(VSTREAM_OUT);
+       vstream_fflush(VSTREAM_OUT);
+       exit(0);
+    }
+    if (strcmp(service_name, "expand_templates") == 0) {
+       bounce_template_expand_all(VSTREAM_OUT);
        vstream_fflush(VSTREAM_OUT);
        exit(0);
     }
index 27a2cd7a0f7497ab67c8a4ab2314b5d162ee8966..fe74aedcf6d3cbee7dcaf03fa7d6f5ff7dd04830 100644 (file)
@@ -208,7 +208,7 @@ static BOUNCE_INFO *bounce_mail_alloc(const char *service,
                                              const char *queue_id,
                                              const char *encoding,
                                              const char *dsn_envid,
-                                             const BOUNCE_TEMPLATE *template,
+                                           const BOUNCE_TEMPLATE *template,
                                              BOUNCE_LOG *log_handle)
 {
     BOUNCE_INFO *bounce_info;
@@ -390,6 +390,7 @@ void    bounce_mail_free(BOUNCE_INFO *bounce_info)
 int     bounce_header(VSTREAM *bounce, BOUNCE_INFO *bounce_info,
                              const char *dest)
 {
+    const BOUNCE_TEMPLATE *template = bounce_info->template;
     int     postmaster_copy;
 
     /*
@@ -402,22 +403,22 @@ int     bounce_header(VSTREAM *bounce, BOUNCE_INFO *bounce_info,
      * XXX This should be caller specified.
      */
     postmaster_copy =
-       (bounce_info->template->postmaster_subject != 0
+       (template->postmaster_subject != 0
         && (dest == var_bounce_rcpt || dest == var_2bounce_rcpt
             || dest == var_delay_rcpt));
 
     /*
      * Generic headers.
      */
-    post_mail_fprintf(bounce, "From: %s", bounce_info->template->from);
+    post_mail_fprintf(bounce, "From: %s", template->from);
     post_mail_fprintf(bounce, "Subject: %s", postmaster_copy ?
-                     bounce_info->template->postmaster_subject :
-                     bounce_info->template->subject);
+                     template->postmaster_subject : template->subject);
     post_mail_fprintf(bounce, "To: %s",
                      STR(quote_822_local(bounce_info->buf, dest)));
 
     /*
-     * MIME header.
+     * MIME header. Use 8bit encoding when either the bounced message or the
+     * template requires it.
      */
     post_mail_fprintf(bounce, "MIME-Version: 1.0");
     post_mail_fprintf(bounce, "Content-Type: %s; report-type=%s;",
@@ -425,7 +426,8 @@ int     bounce_header(VSTREAM *bounce, BOUNCE_INFO *bounce_info,
     post_mail_fprintf(bounce, "\tboundary=\"%s\"", bounce_info->mime_boundary);
     if (bounce_info->mime_encoding)
        post_mail_fprintf(bounce, "Content-Transfer-Encoding: %s",
-                         bounce_info->mime_encoding);
+                    STREQ(bounce_info->mime_encoding, MAIL_ATTR_ENC_7BIT) ?
+                     template->mime_encoding : bounce_info->mime_encoding);
     post_mail_fputs(bounce, "");
     post_mail_fputs(bounce, "This is a MIME-encapsulated message.");
 
@@ -436,7 +438,7 @@ int     bounce_header(VSTREAM *bounce, BOUNCE_INFO *bounce_info,
     post_mail_fprintf(bounce, "--%s", bounce_info->mime_boundary);
     post_mail_fprintf(bounce, "Content-Description: %s", "Notification");
     post_mail_fprintf(bounce, "Content-Type: %s; charset=%s",
-                     "text/plain", bounce_info->template->charset);
+                     "text/plain", template->charset);
     post_mail_fputs(bounce, "");
 
     return (vstream_ferror(bounce));
@@ -450,7 +452,7 @@ int     bounce_boilerplate(VSTREAM *bounce, BOUNCE_INFO *bounce_info)
     /*
      * Print the boiler-plate text.
      */
-    bounce_template_expand(bounce, bounce_info->template);
+    bounce_template_expand(post_mail_fputs, bounce, bounce_info->template);
     return (vstream_ferror(bounce));
 }
 
@@ -523,7 +525,7 @@ int     bounce_diagnostic_log(VSTREAM *bounce, BOUNCE_INFO *bounce_info,
      */
     if (bounce_info->log_handle == 0
        || bounce_log_rewind(bounce_info->log_handle)) {
-       if (bounce_info->template == FAIL_TEMPLATE()) {
+       if (IS_FAIL_TEMPLATE(bounce_info->template)) {
            post_mail_fputs(bounce, "\t--- Delivery report unavailable ---");
            count = 1;                          /* XXX don't abort */
        }
@@ -615,7 +617,7 @@ int     bounce_recipient_dsn(VSTREAM *bounce, BOUNCE_INFO *bounce_info)
                          bounce_info->log_handle->rcpt.orig_addr);
     }
     post_mail_fprintf(bounce, "Action: %s",
-                     bounce_info->template == FAIL_TEMPLATE() ?
+                     IS_FAIL_TEMPLATE(bounce_info->template) ?
                      "failed" : bounce_info->log_handle->dsn.action);
     post_mail_fprintf(bounce, "Status: %s",
                      bounce_info->log_handle->dsn.status);
@@ -637,7 +639,7 @@ int     bounce_recipient_dsn(VSTREAM *bounce, BOUNCE_INFO *bounce_info)
     post_mail_fprintf(bounce, "Last-Attempt-Date: %s",
                      bounce_info->log_handle->log_time);
 #endif
-    if (bounce_info->template == DELAY_TEMPLATE())
+    if (IS_DELAY_TEMPLATE(bounce_info->template))
        post_mail_fprintf(bounce, "Will-Retry-Until: %s",
                 mail_date(bounce_info->arrival_time + var_max_queue_time));
     return (vstream_ferror(bounce));
@@ -661,7 +663,7 @@ int     bounce_diagnostic_dsn(VSTREAM *bounce, BOUNCE_INFO *bounce_info,
      */
     if (bounce_info->log_handle == 0
        || bounce_log_rewind(bounce_info->log_handle)) {
-       if (bounce_info->template == FAIL_TEMPLATE())
+       if (IS_FAIL_TEMPLATE(bounce_info->template))
            count = 1;                          /* XXX don't abort */
     } else {
        while (bounce_log_read(bounce_info->log_handle) != 0) {
@@ -697,13 +699,13 @@ int     bounce_original(VSTREAM *bounce, BOUNCE_INFO *bounce_info,
     /*
      * MIME headers.
      */
-#define UNDELIVERED(template) \
-        ((template) == FAIL_TEMPLATE() || (template) == DELAY_TEMPLATE())
+#define IS_UNDELIVERED_TEMPLATE(template) \
+        (IS_FAIL_TEMPLATE(template) || IS_DELAY_TEMPLATE(template))
 
     post_mail_fputs(bounce, "");
     post_mail_fprintf(bounce, "--%s", bounce_info->mime_boundary);
     post_mail_fprintf(bounce, "Content-Description: %s%s",
-                     UNDELIVERED(bounce_info->template) ?
+                     IS_UNDELIVERED_TEMPLATE(bounce_info->template) ?
                      "Undelivered " : "",
                      headers_only == DSN_RET_HDRS ?
                      "Message Headers" : "Message");
index e0034c08f6375f808eb9d2de7725659cd374c0cc..9a51116092a7013de5a13ff51c93500e235c9570 100644 (file)
@@ -62,26 +62,32 @@ extern void bounce_cleanup_unregister(void);
   * bounce_template.c
   */
 typedef struct {
-    const char *class;                 /* template type */
-    const char *charset;               /* character set */
-    const char *encoding;              /* 7bit or 8bit */
-    const char *from;                  /* originator */
-    const char *subject;               /* general subject line */
-    const char *postmaster_subject;    /* postmaster subject line */
-    const char **message_text;         /* message text */
+    const char *class;                 /* for diagnostics (fixed) */
+    const char *charset;               /* character set (configurable) */
+    const char *mime_encoding;         /* 7bit or 8bit (derived) */
+    const char *from;                  /* originator (configurable) */
+    const char *subject;               /* general subject (configurable) */
+    const char *postmaster_subject;    /* postmaster subject (configurable) */
+    const char **message_text;         /* message text (configurable) */
 } BOUNCE_TEMPLATE;
 
+typedef int (*BOUNCE_OUT_FN)(VSTREAM *, const char *);
 extern void bounce_template_load(const char *);
-extern void bounce_template_expand(VSTREAM *, const BOUNCE_TEMPLATE *);
+extern void bounce_template_expand(BOUNCE_OUT_FN, VSTREAM *, const BOUNCE_TEMPLATE *);
 extern const BOUNCE_TEMPLATE *bounce_template_find(const char *, const BOUNCE_TEMPLATE *);
-extern void bounce_template_dump_default(VSTREAM *);
-extern void bounce_template_dump_actual(VSTREAM *);
+extern void bounce_template_dump_all(VSTREAM *);
+extern void bounce_template_expand_all(VSTREAM *);
+
+#define BOUNCE_TMPL_CLASS_FAIL "failure"
+#define BOUNCE_TMPL_CLASS_DELAY        "delay"
+#define BOUNCE_TMPL_CLASS_SUCCESS "success"
+#define BOUNCE_TMPL_CLASS_VERIFY "verify"
 
 #define BOUNCE_TEMPLATE_DICT   "bounce_templates"
-#define BOUNCE_TMPL_DICT_FAIL  "fail_template"
-#define BOUNCE_TMPL_DICT_DELAY "delay_template"
-#define BOUNCE_TMPL_DICT_SUCCESS "success_template"
-#define BOUNCE_TMPL_DICT_VERIFY        "verify_template"
+#define BOUNCE_TMPL_DICT_FAIL  (BOUNCE_TMPL_CLASS_FAIL "_template")
+#define BOUNCE_TMPL_DICT_DELAY (BOUNCE_TMPL_CLASS_DELAY "_template")
+#define BOUNCE_TMPL_DICT_SUCCESS (BOUNCE_TMPL_CLASS_SUCCESS "_template")
+#define BOUNCE_TMPL_DICT_VERIFY        (BOUNCE_TMPL_CLASS_VERIFY "_template")
 
 #define FAIL_TEMPLATE() \
     (bounce_fail_template ? bounce_fail_template : \
@@ -107,6 +113,15 @@ extern void bounce_template_dump_actual(VSTREAM *);
            bounce_template_find(BOUNCE_TMPL_DICT_VERIFY, \
                &def_bounce_verify_template)))
 
+#define IS_FAIL_TEMPLATE(t)    ((t) == bounce_fail_template)
+#define IS_DELAY_TEMPLATE(t)   ((t) == bounce_delay_template)
+#define IS_SUCCESS_TEMPLATE(t) ((t) == bounce_success_template)
+#define IS_VERIFY_TEMPLATE(t)  ((t) == bounce_verify_template)
+
+ /*
+  * The following are not part of the bounce_template() interface. Use the
+  * above macros instead.
+  */
 extern const BOUNCE_TEMPLATE *bounce_fail_template;
 extern const BOUNCE_TEMPLATE *bounce_delay_template;
 extern const BOUNCE_TEMPLATE *bounce_success_template;
index 78ccea3a9d5939227ff1ed6b35bbf836e109606f..619cf6ebe3505881ce8d30010337a0ff114f7d6a 100644 (file)
 /*     VSTREAM *stream;
 /*     BOUNCE_TEMPLATE *template;
 /* AUXILIARY FUNCTIONS
-/*     void    bounce_template_dump_default(stream)
+/*     void    bounce_template_dump_all(stream)
 /*     VSTREAM *stream;
 /*
-/*     void    bounce_template_dump_actual(stream)
+/*     void    bounce_template_expand_all(stream)
 /*     VSTREAM *stream;
 /* DESCRIPTION
 /*     This module implements the built-in and external bounce
 /*     to the specified stream. This can be used to verify that
 /*     the bounce server correctly reads its own bounce_template_dump_default()
 /*     output.
+/*
+/*     bounce_template_expand_actual() expands the template message
+/*     text and dumps the result to the specified stream. This can
+/*     be used to verify that templates produce the desired text.
 /* DIAGNOSTICS
 /*     Fatal error: error opening template file, out of memory,
 /*     undefined macro name in template.
 static const char *def_bounce_fail_body[];
 
 const BOUNCE_TEMPLATE def_bounce_fail_template = {
-    "fail",
+    BOUNCE_TMPL_CLASS_FAIL,
     "us-ascii",
     MAIL_ATTR_ENC_7BIT,
     MAIL_ADDR_MAIL_DAEMON " (Mail Delivery System)",
@@ -132,7 +136,7 @@ static const char *def_bounce_fail_body[] = {
 static const char *def_bounce_delay_body[];
 
 const BOUNCE_TEMPLATE def_bounce_delay_template = {
-    "delay",
+    BOUNCE_TMPL_CLASS_DELAY,
     "us-ascii",
     MAIL_ATTR_ENC_7BIT,
     MAIL_ADDR_MAIL_DAEMON " (Mail Delivery System)",
@@ -167,7 +171,7 @@ static const char *def_bounce_delay_body[] = {
 static const char *def_bounce_success_body[];
 
 const BOUNCE_TEMPLATE def_bounce_success_template = {
-    "success",
+    BOUNCE_TMPL_CLASS_SUCCESS,
     "us-ascii",
     MAIL_ATTR_ENC_7BIT,
     MAIL_ADDR_MAIL_DAEMON " (Mail Delivery System)",
@@ -195,7 +199,7 @@ static const char *def_bounce_success_body[] = {
 static const char *def_bounce_verify_body[];
 
 const BOUNCE_TEMPLATE def_bounce_verify_template = {
-    "verify",
+    BOUNCE_TMPL_CLASS_VERIFY,
     "us-ascii",
     MAIL_ATTR_ENC_7BIT,
     MAIL_ADDR_MAIL_DAEMON " (Mail Delivery System)",
@@ -318,17 +322,21 @@ static const char *bounce_template_lookup(const char *key, int unused_mode,
                if (strcmp(key + bp->param_name_len + 1, bd->suffix) == 0) {
                    result = bp->value[0] / bd->divisor;
                    if (result > 999 && bd->divisor < 86400) {
-                       msg_warn("excessive result \"%d\" in %s bounce "
+                       msg_warn("%s: excessive result \"%d\" in %s "
                                 "template conversion of parameter \"%s\"",
+                         *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
                                 result, template->class, key);
                        msg_warn("please increase time unit \"%s\" of \"%s\" "
-                                "in bounce template file", bd->suffix, key);
-                   } else if (result == 0 && bd->divisor > 1) {
-                       msg_warn("zero result in %s bounce template "
+                                "in %s template", bd->suffix, key,
+                                template->class);
+                   } else if (result == 0 && bp->value[0] && bd->divisor > 1) {
+                       msg_warn("%s: zero result in %s template "
                                 "conversion of parameter \"%s\"",
+                         *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
                                 template->class, key);
                        msg_warn("please reduce time unit \"%s\" of \"%s\" "
-                                "in bounce template file", bd->suffix, key);
+                                "in %s template", bd->suffix, key,
+                                template->class);
                    }
                    if (buf == 0)
                        buf = vstring_alloc(10);
@@ -336,7 +344,8 @@ static const char *bounce_template_lookup(const char *key, int unused_mode,
                    return (STR(buf));
                }
            }
-           msg_fatal("unrecognized suffix \"%s\" in template parameter \"%s\"",
+           msg_fatal("%s: unrecognized suffix \"%s\" in parameter \"%s\"",
+                     *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
                      key + bp->param_name_len + 1, key);
        }
     }
@@ -345,7 +354,8 @@ static const char *bounce_template_lookup(const char *key, int unused_mode,
 
 /* bounce_template_expand - expand template body */
 
-void    bounce_template_expand(VSTREAM *stream, const BOUNCE_TEMPLATE *template)
+void    bounce_template_expand(BOUNCE_OUT_FN out_fn, VSTREAM *stream,
+                                      const BOUNCE_TEMPLATE *template)
 {
     VSTRING *buf = vstring_alloc(100);
     const char **cpp;
@@ -358,12 +368,14 @@ void    bounce_template_expand(VSTREAM *stream, const BOUNCE_TEMPLATE *template)
        stat = mac_expand(buf, *cpp, MAC_EXP_FLAG_NONE, filter,
                          bounce_template_lookup, (char *) template);
        if (stat & MAC_PARSE_ERROR)
-           msg_fatal("bad $name syntax in %s template: %s",
+           msg_fatal("%s: bad $name syntax in %s template: %s",
+                     *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
                      template->class, *cpp);
        if (stat & MAC_PARSE_UNDEF)
-           msg_fatal("undefined $name in %s template: %s",
+           msg_fatal("%s: undefined $name in %s template: %s",
+                     *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
                      template->class, *cpp);
-       post_mail_fputs(stream, STR(buf));
+       out_fn(stream, STR(buf));
     }
     vstring_free(buf);
 }
@@ -423,19 +435,22 @@ const BOUNCE_TEMPLATE *bounce_template_find(const char *template_name,
      */
 #define GETLINE(line, buf) \
        (((line) = (buf)) ? ((buf) = split_at((buf), '\n'), (line)) : 0)
-/*#define GETLINE(line, buf) (line = mystrtok(&buf, "\n"))*/
 
     while ((GETLINE(cp, tval)) != 0 && (hlen = is_header(cp)) > 0) {
        for (hval = cp + hlen; *hval && (*hval == ':' || ISSPACE(*hval)); hval++)
            *hval = 0;
        if (*hval == 0) {
-           msg_warn("empty \"%s\" header value in %s template "
-                    "-- ignoring this template", cp, template_name);
+           msg_warn("%s: empty \"%s\" header value in %s template "
+                    "-- ignoring this template",
+                    *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
+                    cp, template_name);
            CLEANUP_AND_RETURN(def_template);
        }
        if (!allascii(hval)) {
-           msg_warn("non-ASCII \"%s\" header value in %s template "
-                    "-- ignoring this template", cp, template_name);
+           msg_warn("%s: non-ASCII \"%s\" header value in %s template "
+                    "-- ignoring this template",
+                    *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
+                    cp, template_name);
            CLEANUP_AND_RETURN(def_template);
        }
        if (strcasecmp("charset", cp) == 0) {
@@ -446,14 +461,18 @@ const BOUNCE_TEMPLATE *bounce_template_find(const char *template_name,
            tp->subject = hval;
        } else if (strcasecmp("postmaster-subject", cp) == 0) {
            if (tp->postmaster_subject == 0) {
-               msg_warn("\"%s\" header label in %s template is not applicable "
-                        "-- ignoring this template", cp, template_name);
+               msg_warn("%s: inapplicable \"%s\" header label in %s template "
+                        "-- ignoring this template",
+                        *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
+                        cp, template_name);
                CLEANUP_AND_RETURN(def_template);
            }
            tp->postmaster_subject = hval;
        } else {
-           msg_warn("unknown \"%s\" header label in %s template "
-                    "-- ignoring this template", cp, template_name);
+           msg_warn("%s: unknown \"%s\" header label in %s template "
+                    "-- ignoring this template",
+                    *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
+                    cp, template_name);
            CLEANUP_AND_RETURN(def_template);
        }
     }
@@ -464,8 +483,10 @@ const BOUNCE_TEMPLATE *bounce_template_find(const char *template_name,
     while (cp && (*cp == 0 || allspace(cp)))
        (void) GETLINE(cp, tval);
     if (cp == 0) {
-       msg_warn("missing message text in %s template "
-                "-- ignoring this template", template_name);
+       msg_warn("%s: missing message text in %s template "
+                "-- ignoring this template",
+                *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
+                template_name);
        CLEANUP_AND_RETURN(def_template);
     }
 
@@ -477,12 +498,14 @@ const BOUNCE_TEMPLATE *bounce_template_find(const char *template_name,
 
     if (NON_ASCII(cp) || NON_ASCII(tval)) {
        if (strcasecmp(tp->charset, "us-ascii") == 0) {
-           msg_warn("8-bit message text in %s template", template_name);
+           msg_warn("%s: 8-bit message text in %s template",
+                    *var_bounce_tmpl ? var_bounce_tmpl : "[built-in]",
+                    template_name);
            msg_warn("please specify a charset value other than us-ascii");
            msg_warn("-- ignoring this template for now");
            CLEANUP_AND_RETURN(def_template);
        }
-       tp->encoding = MAIL_ATTR_ENC_8BIT;
+       tp->mime_encoding = MAIL_ATTR_ENC_8BIT;
     }
 
     /*
@@ -526,22 +549,44 @@ static void print_template(VSTREAM *stream, const BOUNCE_TEMPLATE *tp)
     vstream_fflush(stream);
 }
 
-/* bounce_template_dump_actual - dump actual templates to stream */
+/* bounce_template_dump_all - dump bounce templates to stream */
 
-void    bounce_template_dump_actual(VSTREAM *stream)
+void    bounce_template_dump_all(VSTREAM *stream)
 {
     print_template(VSTREAM_OUT, FAIL_TEMPLATE());
+    vstream_fprintf(stream, "\n");
     print_template(VSTREAM_OUT, DELAY_TEMPLATE());
+    vstream_fprintf(stream, "\n");
     print_template(VSTREAM_OUT, SUCCESS_TEMPLATE());
+    vstream_fprintf(stream, "\n");
     print_template(VSTREAM_OUT, VERIFY_TEMPLATE());
 }
 
-/* bounce_template_dump_default - dump built-in templates to stream */
+/* bounce_plain_out - output line as plain text */
+
+static int bounce_plain_out(VSTREAM *stream, const char *text)
+{
+    vstream_fprintf(stream, "%s\n", text);
+    return (0);
+}
+
+/* bounce_template_expand_all - dump expanded template text to stream */
 
-void    bounce_template_dump_default(VSTREAM *stream)
+void    bounce_template_expand_all(VSTREAM *stream)
 {
-    print_template(VSTREAM_OUT, &def_bounce_fail_template);
-    print_template(VSTREAM_OUT, &def_bounce_delay_template);
-    print_template(VSTREAM_OUT, &def_bounce_success_template);
-    print_template(VSTREAM_OUT, &def_bounce_verify_template);
+    const BOUNCE_TEMPLATE *tp;
+
+    tp = FAIL_TEMPLATE();
+    vstream_fprintf(VSTREAM_OUT, "expanded_%s_text = <<EOF\n", tp->class);
+    bounce_template_expand(bounce_plain_out, VSTREAM_OUT, tp);
+    tp = DELAY_TEMPLATE();
+    vstream_fprintf(VSTREAM_OUT, "EOF\n\nexpanded_%s_text = <<EOF\n", tp->class);
+    bounce_template_expand(bounce_plain_out, VSTREAM_OUT, tp);
+    tp = SUCCESS_TEMPLATE();
+    vstream_fprintf(VSTREAM_OUT, "EOF\n\nexpanded_%s_text = <<EOF\n", tp->class);
+    bounce_template_expand(bounce_plain_out, VSTREAM_OUT, tp);
+    tp = VERIFY_TEMPLATE();
+    vstream_fprintf(VSTREAM_OUT, "EOF\n\nexpanded_%s_text = <<EOF\n", tp->class);
+    bounce_template_expand(bounce_plain_out, VSTREAM_OUT, tp);
+    vstream_fprintf(VSTREAM_OUT, "EOF\n");
 }
index 2cd5ce343a3f4b34b700845ceef8f9acdde2b017..0485ca136f0a642c0f3edc1ee5677185ee8940b7 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20051112"
+#define MAIL_RELEASE_DATE      "20051114"
 #define MAIL_VERSION_NUMBER    "2.3"
 
 #ifdef SNAPSHOT
index d0ea495ef80c9eb75916887363b00252efe379cb..d361b2c55b104ed16eb5e9c854290b181c93aec8 100644 (file)
 
 #include <msg.h>
 #include <msg_syslog.h>
+#include <msg_vstream.h>
 #include <chroot_uid.h>
 #include <listen.h>
 #include <events.h>
@@ -249,7 +250,7 @@ static void multi_server_timeout(int unused_event, char *unused_context)
 
 /*  multi_server_drain - stop accepting new clients */
 
-int multi_server_drain(void)
+int     multi_server_drain(void)
 {
     int     fd;
 
@@ -472,15 +473,18 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...)
     MAIL_SERVER_LOOP_FN loop = 0;
     int     key;
     char   *transport = 0;
+
 #if 0
     char   *lock_path;
     VSTRING *why;
+
 #endif
     int     alone = 0;
     int     zerolimit = 0;
     WATCHDOG *watchdog;
     char   *oval;
     char   *generation;
+    int     msg_vstream_needed = 0;
 
     /*
      * Process environment options as early as we can.
@@ -532,7 +536,7 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...)
      * stderr, because no-one is going to see them.
      */
     opterr = 0;
-    while ((c = GETOPT(argc, argv, "cdDi:lm:n:o:s:St:uvz")) > 0) {
+    while ((c = GETOPT(argc, argv, "cdDi:lm:n:o:s:St:uvVz")) > 0) {
        switch (c) {
        case 'c':
            root_dir = "setme";
@@ -576,6 +580,10 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...)
        case 'v':
            msg_verbose++;
            break;
+       case 'V':
+           if (++msg_vstream_needed == 1)
+               msg_vstream_init(mail_task(var_procname), VSTREAM_ERR);
+           break;
        case 'z':
            zerolimit = 1;
            break;
@@ -633,12 +641,12 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...)
            multi_server_in_flow_delay = 1;
            break;
        case MAIL_SERVER_SOLITARY:
-           if (!alone)
+           if (stream == 0 && !alone)
                msg_fatal("service %s requires a process limit of 1",
                          service_name);
            break;
        case MAIL_SERVER_UNLIMITED:
-           if (!zerolimit)
+           if (stream == 0 && !zerolimit)
                msg_fatal("service %s requires a process limit of 0",
                          service_name);
            break;
index 99209fb21b890cb3608ef43e650c6e31564c843a..6cfefa16cb1bdad653e6618de1f68541c4ea25a8 100644 (file)
 
 #include <msg.h>
 #include <msg_syslog.h>
+#include <msg_vstream.h>
 #include <chroot_uid.h>
 #include <vstring.h>
 #include <vstream.h>
@@ -397,6 +398,7 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...)
     WATCHDOG *watchdog;
     char   *oval;
     char   *generation;
+    int     msg_vstream_needed = 0;
 
     /*
      * Process environment options as early as we can.
@@ -448,7 +450,7 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...)
      * stderr, because no-one is going to see them.
      */
     opterr = 0;
-    while ((c = GETOPT(argc, argv, "cdDi:lm:n:o:s:St:uvz")) > 0) {
+    while ((c = GETOPT(argc, argv, "cdDi:lm:n:o:s:St:uvVz")) > 0) {
        switch (c) {
        case 'c':
            root_dir = "setme";
@@ -492,6 +494,10 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...)
        case 'v':
            msg_verbose++;
            break;
+       case 'V':
+           if (++msg_vstream_needed == 1)
+               msg_vstream_init(mail_task(var_procname), VSTREAM_ERR);
+           break;
        case 'z':
            zerolimit = 1;
            break;
@@ -546,12 +552,12 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...)
            single_server_in_flow_delay = 1;
            break;
        case MAIL_SERVER_SOLITARY:
-           if (!alone)
+           if (stream == 0 && !alone)
                msg_fatal("service %s requires a process limit of 1",
                          service_name);
            break;
        case MAIL_SERVER_UNLIMITED:
-           if (!zerolimit)
+           if (stream == 0 && !zerolimit)
                msg_fatal("service %s requires a process limit of 0",
                          service_name);
            break;
index 4bef255bc61ab6df93025183783e01c9ab178da6..b7e672429718b78d6f4bb3fc8b827db82d5ba444 100644 (file)
 
 #include <msg.h>
 #include <msg_syslog.h>
+#include <msg_vstream.h>
 #include <chroot_uid.h>
 #include <vstring.h>
 #include <vstream.h>
@@ -403,6 +404,7 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,..
     WATCHDOG *watchdog;
     char   *oval;
     char   *generation;
+    int     msg_vstream_needed = 0;
 
     /*
      * Process environment options as early as we can.
@@ -454,7 +456,7 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,..
      * stderr, because no-one is going to see them.
      */
     opterr = 0;
-    while ((c = GETOPT(argc, argv, "cdDi:lm:n:o:s:St:uvz")) > 0) {
+    while ((c = GETOPT(argc, argv, "cdDi:lm:n:o:s:St:uvVz")) > 0) {
        switch (c) {
        case 'c':
            root_dir = "setme";
@@ -498,6 +500,10 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,..
        case 'v':
            msg_verbose++;
            break;
+       case 'V':
+           if (++msg_vstream_needed == 1)
+               msg_vstream_init(mail_task(var_procname), VSTREAM_ERR);
+           break;
        case 'z':
            zerolimit = 1;
            break;
@@ -552,12 +558,12 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,..
            trigger_server_in_flow_delay = 1;
            break;
        case MAIL_SERVER_SOLITARY:
-           if (!alone)
+           if (stream == 0 && !alone)
                msg_fatal("service %s requires a process limit of 1",
                          service_name);
            break;
        case MAIL_SERVER_UNLIMITED:
-           if (!zerolimit)
+           if (stream == 0 && !zerolimit)
                msg_fatal("service %s requires a process limit of 0",
                          service_name);
            break;
index caf534f28cbed57b12206ef75429ae1aa16e65da..db3f9cb193e7961caf49683a87383cae2e5ce2f1 100644 (file)
@@ -81,6 +81,7 @@ postconf.o: ../../include/mail_conf.h
 postconf.o: ../../include/mail_dict.h
 postconf.o: ../../include/mail_params.h
 postconf.o: ../../include/mail_proto.h
+postconf.o: ../../include/mail_run.h
 postconf.o: ../../include/mail_version.h
 postconf.o: ../../include/mbox_conf.h
 postconf.o: ../../include/msg.h
index 3326228490e672a0c05f615a4b2f82bea4133317..42bad2ef6e10fd228fc28becc257b5991f18d077 100644 (file)
 /*
 /*     \fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
 /*     [\fIparameter=value ...\fR]
+/*
+/*     \fBpostconf\fR [\fB-btv\fR] [\fB-c \fIconfig_dir\fR] [\fItemplate_file\fR]
 /* DESCRIPTION
-/*     The \fBpostconf\fR(1) command prints the actual value of
-/*     \fIparameter\fR (all known parameters by default) one
-/*     parameter per line, changes its value, or prints other
-/*     information about the Postfix mail system.
+/*     The \fBpostconf\fR(1) command displays the actual values
+/*     of configuration parameters, changes configuration parameter
+/*     values, or displays other configuration information about
+/*     the Postfix mail system.
 /*
 /*     Options:
+/* .IP "\fB-b\fR [\fItemplate_file\fR]"
+/*     Display the message text that appears at the beginning of
+/*     delivery status notification (DSN) messages, with $\fBname\fR
+/*     expressions replaced by actual values.  To override the
+/*     built-in message text, specify a template file at the end
+/*     of the command line, or specify a template file in main.cf
+/*     with the \fBbounce_template_file\fR parameter.
+/*     To force selection of the built-in message text templates,
+/*     specify an empty template file name (in shell language: "").
+/*
+/*     This feature is available with Postfix 2.3 and later.
 /* .IP "\fB-c \fIconfig_dir\fR"
 /*     The \fBmain.cf\fR configuration file is in the named directory
 /*     instead of the default configuration directory.
 /*     The result is a group file entry in \fBgroup\fR(5) format.
 /* .RE
 /* .RE
-/* .sp
+/* .IP
 /*     Other table types may exist depending on how Postfix was built.
 /* .IP \fB-n\fR
 /*     Print parameter settings that are not left at their built-in
 /*     default value, because they are explicitly specified in main.cf.
+/* .IP "\fB-t\fR [\fItemplate_file\fR]"
+/*     Display the templates for delivery status notification (DSN)
+/*     messages. To override the built-in templates, specify a
+/*     template file at the end of the command line, or specify a
+/*     template file in main.cf with the \fBbounce_template_file\fR
+/*     parameter.  To force selection of the built-in templates,
+/*     specify an empty template file name (in shell language:
+/*     "").
+/*
+/*     This feature is available with Postfix 2.3 and later.
 /* .IP \fB-v\fR
 /*     Enable verbose logging for debugging purposes. Multiple \fB-v\fR
 /*     options make the software increasingly verbose.
 /* .IP "\fBconfig_directory (see 'postconf -d' output)\fR"
 /*     The default location of the Postfix main.cf and master.cf
 /*     configuration files.
+/* .IP "\fBbounce_template_file (empty)\fR"
+/*     Pathname of a configuration file with bounce message templates.
 /* FILES
 /*     /etc/postfix/main.cf, Postfix configuration parameters
 /* SEE ALSO
+/*     bounce(5), bouce template file format
 /*     postconf(5), configuration parameters
 /* README FILES
 /* .ad
 #include <vstring_vstream.h>
 #include <myflock.h>
 #include <inet_proto.h>
+#include <argv.h>
 
 /* Global library. */
 
 #include <mail_params.h>
 #include <mail_addr.h>
 #include <mbox_conf.h>
+#include <mail_run.h>
 
  /*
   * What we're supposed to be doing.
@@ -900,6 +928,7 @@ int     main(int argc, char **argv)
     int     fd;
     struct stat st;
     int     junk;
+    ARGV   *ext_argv = 0;
 
     /*
      * Be consistent with file permissions.
@@ -924,8 +953,14 @@ int     main(int argc, char **argv)
     /*
      * Parse JCL.
      */
-    while ((ch = GETOPT(argc, argv, "c:deEhmlnv")) > 0) {
+    while ((ch = GETOPT(argc, argv, "bc:deEhmlntv")) > 0) {
        switch (ch) {
+       case 'b':
+           if (ext_argv)
+               msg_fatal("specify one of -b and -t");
+           ext_argv = argv_alloc(2);
+           argv_add(ext_argv, "bounce", "-SVnexpand_templates", (char *) 0);
+           break;
        case 'c':
            if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
                msg_fatal("out of memory");
@@ -960,11 +995,17 @@ int     main(int argc, char **argv)
        case 'n':
            mode |= SHOW_NONDEF;
            break;
+       case 't':
+           if (ext_argv)
+               msg_fatal("specify one of -b and -t");
+           ext_argv = argv_alloc(2);
+           argv_add(ext_argv, "bounce", "-SVndump_templates", (char *) 0);
+           break;
        case 'v':
            msg_verbose++;
            break;
        default:
-           msg_fatal("usage: %s [-c config_dir] [-d (defaults)] [-e (edit)] [-h (no names)] [-l (lock types)] [-m (map types)] [-n (non-defaults)] [-v] [name...]", argv[0]);
+           msg_fatal("usage: %s [-b (bounce templates)] [-c config_dir] [-d (defaults)] [-e (edit)] [-h (no names)] [-l (lock types)] [-m (map types)] [-n (non-defaults)] [-v] [name...]", argv[0]);
        }
     }
 
@@ -972,9 +1013,31 @@ int     main(int argc, char **argv)
      * Sanity check.
      */
     junk = (mode & (SHOW_DEFS | SHOW_NONDEF | SHOW_MAPS | SHOW_LOCKS | EDIT_MAIN));
-    if (junk != 0 && junk != SHOW_DEFS && junk != SHOW_NONDEF
-       && junk != SHOW_MAPS && junk != SHOW_LOCKS && junk != EDIT_MAIN)
-       msg_fatal("specify one of -d, -e, -m, -l and -n");
+    if (junk != 0 && ((junk != SHOW_DEFS && junk != SHOW_NONDEF
+           && junk != SHOW_MAPS && junk != SHOW_LOCKS && junk != EDIT_MAIN)
+                     || ext_argv != 0))
+       msg_fatal("specify one of -b, -d, -e, -m, -l and -n");
+
+    /*
+     * Display bounce template information and exit.
+     */
+    if (ext_argv) {
+       if (argv[optind]) {
+           if (argv[optind + 1])
+               msg_fatal("options -b and -t require at most one template file");
+           argv_add(ext_argv, "-o",
+                    concatenate(VAR_BOUNCE_TMPL, "=",
+                                argv[optind], (char *) 0),
+                    (char *) 0);
+       }
+       /* Grr... */
+       argv_add(ext_argv, "-o",
+                concatenate(VAR_QUEUE_DIR, "=", ".", (char *) 0),
+                (char *) 0);
+       mail_conf_read();
+       mail_run_replace(var_daemon_dir, ext_argv->argv);
+       /* NOTREACHED */
+    }
 
     /*
      * If showing map types, show them and exit
index c2bb64cc491405e1567c4047f6929b895d6de38d..fded3afe834fb0ce81cb16574140e6a8731633c2 100644 (file)
 /*     sendmail(1), Sendmail compatibility interface
 /*
 /*     Postfix configuration:
+/*     bounce(5), Postfix bounce message templates
 /*     master(5), Postfix master.cf file syntax
 /*     postconf(5), Postfix main.cf file syntax
 /*