我想知道是否可以将 postfix 配置为重定向到多个电子邮件地址(包括原始收件人)而不是仅一个?
这是我的情况:当电子邮件是:
来自:[电子邮件受保护]
结果:将电子邮件重定向至[电子邮件受保护]并交付给原始收件人
这个问题在这里得到了部分回答: https://serverfault.com/questions/284702/redirect-specific-e-mail-address-sent-to-a-user-to-another-user
答案1
答案2
我用 procmail 解决了这个问题。
来源:http://www.netikka.net/tsneti/info/proctips.php#forward
下面是一个例子:
#Get the sender's bare email address from the first "From" line
FROM_=`formail -c -x"From " \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g' \
| awk '{ print $1 }'`
#Get the original subject of the email
#Discard superfluous tabs and spaces
#On some systems -xSubject: has to be -x"Subject: "
SUBJ_=`formail -c -xSubject: \
| expand \
| sed -e 's/ */ /g' \
| sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
#Whatever other recipes you'll use
:0
* ^From:.*infolist@([-a-z0-9_]+\.)*infohost\.infodom
# Avoid email loops
* ! ^X-Loop: myid@myhost\.mydom
{
:0c: #Preserve a copy of the email
Infolist.mail
:0fwh #Adjust some headers before forwarding
| formail -A"X-Loop: [email protected]" \
-A"X-From-Origin: ${FROM_}" \
-i"Subject: $SUBJ_ (fwd)"
# Forward the email
:0
[email protected]
}