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:
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
======================================
$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
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)\"`"
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 >$@
--- /dev/null
+<!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> <<<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> <<<b>'EOF'</b>).
+ Here is an example:
+
+ # 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 $<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 <postmaster>
+
+ 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 << 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>
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:
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.
/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
<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
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>
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>
(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>
<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
<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
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
man5/aliases.5: ../proto/aliases
../mantools/srctoman - $? >$@
+man5/bounce.5: ../proto/bounce
+ ../mantools/srctoman - $? >$@
+
man5/canonical.5: ../proto/canonical
../mantools/srctoman - $? >$@
\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.
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.
.SH "FILES"
.na
.nf
.SH "SEE ALSO"
.na
.nf
+bounce(5), bouce template file format
postconf(5), configuration parameters
.SH "README FILES"
.na
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
--- /dev/null
+.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
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)
.SH NAME
bounce
\-
-Postfix message bounce or defer daemon
+Postfix delivery status reports
.SH "SYNOPSIS"
.na
.nf
.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).
.SH "SEE ALSO"
.na
.nf
+bounce(5), bounce message template format
qmgr(8), queue manager
postconf(5), configuration parameters
master(5), generic daemon options
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;
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;
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;
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;
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;
--- /dev/null
+#++
+# 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
+#--
%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>
$(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
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; \
# 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.
#
/* 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>
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.
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);
}
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;
int bounce_header(VSTREAM *bounce, BOUNCE_INFO *bounce_info,
const char *dest)
{
+ const BOUNCE_TEMPLATE *template = bounce_info->template;
int postmaster_copy;
/*
* 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;",
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.");
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));
/*
* 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));
}
*/
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 */
}
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);
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));
*/
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) {
/*
* 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");
* 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 : \
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;
/* 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)",
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)",
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)",
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)",
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);
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);
}
}
/* 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;
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);
}
*/
#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) {
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);
}
}
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);
}
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;
}
/*
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");
}
* 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
#include <msg.h>
#include <msg_syslog.h>
+#include <msg_vstream.h>
#include <chroot_uid.h>
#include <listen.h>
#include <events.h>
/* multi_server_drain - stop accepting new clients */
-int multi_server_drain(void)
+int multi_server_drain(void)
{
int fd;
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.
* 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";
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;
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;
#include <msg.h>
#include <msg_syslog.h>
+#include <msg_vstream.h>
#include <chroot_uid.h>
#include <vstring.h>
#include <vstream.h>
WATCHDOG *watchdog;
char *oval;
char *generation;
+ int msg_vstream_needed = 0;
/*
* Process environment options as early as we can.
* 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";
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;
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;
#include <msg.h>
#include <msg_syslog.h>
+#include <msg_vstream.h>
#include <chroot_uid.h>
#include <vstring.h>
#include <vstream.h>
WATCHDOG *watchdog;
char *oval;
char *generation;
+ int msg_vstream_needed = 0;
/*
* Process environment options as early as we can.
* 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";
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;
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;
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
/*
/* \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.
int fd;
struct stat st;
int junk;
+ ARGV *ext_argv = 0;
/*
* Be consistent with file permissions.
/*
* 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");
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]);
}
}
* 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
/* 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
/*