Postfix 版本需要 2.3 以上

先確認版本 → postconf -d | grep mail_version

mail_version = 2.4.5
milter_macro_v = $mail_name $mail_version

可以使用的範本名稱有

failure_template
delay_template
success_template
verify_template

使用方式是用 failure_template = <<EOF 為開頭,EOF 結尾

編輯 vi /etc/postfix/bounce.cf

#
# 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.
failure_template = <<EOF
Charset: utf-8
From: MAILER-DAEMON (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
Postmaster-Subject: Postmaster Copy: Undelivered Mail

這是在電子郵件系統主機 $myhostname 。

我很抱歉地通知您,您的郵件無法
交付給一個或多個收件人。它附在下面。

如需進一步的協助,請發送電子郵件至<postmaster>

如果您這樣做,請包括這個問題報告。您可以
刪除您自己的文字從所附的返回信息。

The mail system
EOF

#
# The delay template is used when mail is delayed. Note a neat trick:
# the default template displays the delay_warning_time value as hours
# by appending the _hours suffix to the parameter name; it displays
# the maximal_queue_lifetime value as days by appending the _days
# suffix.
#
# Other suffixes are: _seconds, _minutes, _weeks. There are no other
# main.cf parameters that have this special behavior.
#
# You need to adjust these suffixes (and the surrounding text) if
# you have very different settings for these time parameters.
#
delay_template = <<EOF
Charset: utf-8
From: MAILER-DAEMON (Mail Delivery System)
Subject: Delayed Mail (still being retried)
Postmaster-Subject: Postmaster Warning: Delayed Mail

This is the mail system at host $myhostname.

####################################################################
# THIS IS A WARNING ONLY.  YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
####################################################################
您的郵件無法交付美元以上 $delay_warning_time_hours 小時(星期日) 。
這將是重試,直到為 $maximal_queue_lifetime_days 一天( S )舊。

如需進一步的協助,請發送電子郵件至<postmaster>

如果您這樣做,請包括這個問題報告。您可以
刪除您自己的文字從所附的返回信息。

The mail system
EOF

#
# The success template is used when mail is delivered to mailbox,
# when an alias or list is expanded, or when mail is delivered to a
# system that does not announce DSN support. It is an error to specify
# a Postmaster-Subject: here.
#
success_template = <<EOF
Charset: utf-8
From: MAILER-DAEMON (Mail Delivery System)
Subject: Successful Mail Delivery Report

這是在電子郵件系統主機 $myhostname 。

您的留言已成功運到目的地(星期日)
列在了下面。如果郵件被送到您的郵箱
沒有收到進一步的通知。否則,你可能還會收到
通知郵件傳遞錯誤來自其他系統。

The mail system
EOF

#
# The verify template is used for address verification (sendmail -bv
# address…). or for verbose mail delivery (sendmail -v address…).
# It is an error to specify a Postmaster-Subject: here.
#
verify_template = <<EOF
Charset: utf-8
From: MAILER-DAEMON (Mail Delivery System)
Subject: Mail Delivery Status Report

這是在電子郵件系統主機 $myhostname 。

封閉是郵件傳遞報告說,你的要求。

The mail system
EOF

以上中文部份是由翻譯機器所翻的

將設定寫入 /etc/postfix/main.cf

postconf -e ‘bounce_template_file = /etc/postfix/bounce.cf’

執行 postconf -b /etc/postfix/bounce.cf 要認 /etc/postfix/bounce.cf 裡面的變數有成功轉換,或者有沒有錯誤訊息

測試寄信至 yahoo.com.tw

收到的退信訊息

要縮短測試時間可以這麼作

postconf -e ‘maximal_queue_lifetime = 1d’
postconf -e ‘delay_warning_time = 0h’
postconf -e ‘bounce_queue_lifetime = 1d’


參考文件: http://www.howtoforge.com/configure-custom-postfix-bounce-messages

Related posts 相關文章
postfix 怎麼記錄信件主旨於 maillog 中
More...
讓 Plesk 的 Postfix 使用 Domain Key、SPF
More...
postfix 利用 postfwd2 限制寄信數量
More...
Postfix 如何讓某個帳號跑另一個 IP 寄信出去
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。