Postfix - 地址重写 - 回复全部

Postfix - 地址重写 - 回复全部

我有一台 Red Hat Enterprise Linux Server 版本 7.6 (Maipo),带有 postfix 版本 2.10.1。我仅将其用作中继 - 没有本地邮箱。

此服务器应该用于重写地址。我已尝试使用recipient_canonical和virtual。总的来说,它有效。我的问题是,如果收件人收到邮件并点击“回复所有人”(例如在Outlook中),我期望只看到发件人的地址。但实际上我也看到了收件人的旧地址(重写之前)。这意味着使用“回复所有人”,“我”将使用我的旧地址向自己发送邮件。

示例:postfix 接收来自[电子邮件保护]到 whoever@old_domain.tld。使用recipient_canonical 收件人地址将重写为 whoever@new_domain.tld,然后 postfix 将此邮件发送到下一跳。如果现在 whoever@new_domain.tld 在其邮件客户端上按“回复所有人”[电子邮件保护]出现(如预期),但 whoever@old_domain.tld 也出现。这不是我们想要的。

我这里做错了什么?提前谢谢您!

补充:在 gmx 我仍然看到旧地址,并且 gmx 将其放在 CC 中

收件人典型类别 = 信封收件人,报头收件人

main.cf
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix

myhostname = srv5240.xxxxx.com
mydomain = xxxxxxx^.com
myorigin = $myhostname

inet_interfaces = all
inet_protocols = ipv4

mydestination = $myhostname, localhost.$mydomain, localhost

unknown_local_recipient_reject_code = 550

mynetworks_style = host
mynetworks = $config_directory/mynetworks

transport_maps = hash:$config_directory/transport


smtpd_recipient_restrictions =
  permit_mynetworks
  reject_unauth_destination
  reject

relayhost = [smtpdo.xxxxx.com]
smtp_fallback_relay = [smtpkr.xxxxx.com]

alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases

smtpd_banner = $myhostname ESMTP - AM redirector
smtp_helo_name = $myhostname

debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES

canonical_classes = envelope_sender, envelope_recipient, header_sender, header_recipient
canonical_maps = hash:$config_directory/canonical

sender_canonical_classes = envelope_sender
#sender_canonical_maps = hash:$config_directory/sender_canonical

recipient_canonical_classes = envelope_recipient, header_recipient
#recipient_canonical_maps = mysql:$config_directory/recipient_canonical.cf
#recipient_canonical_maps = hash:$config_directory/recipient_canonical

2bounce_notice_recipient = postmaster
bounce_notice_recipient = postmaster
bounce_queue_lifetime = 5d
bounce_template_file = $config_directory/bounce.cf

delay_warning_time = 4h

parent_domain_matches_subdomains = no
disable_vrfy_command = yes
mailbox_size_limit = 51200000
message_size_limit = 20480000
canonical
[email protected]   [email protected]
header (shorten/anonymous)
Return-Path: <[email protected]>
Received: from  by mx-ha.gmx.net
(mxgmx012 [212.227.15.9]) with ESMTPS (Nemesis) id 0MKuG0-1hD1KR1CWO-0000n8
for <[email protected]>; Sun, 07 Apr 2019 08:30:55 +0200
...
Received: from )
                (using TLSv1 with cipher AES256-SHA (256/256 bits))
                (No client certificate requested)
                by srv1712 (Postfix) with ESMTPS id CE70D6492E
                for <[email protected]>; Sun,  7 Apr 2019 08:30:53 +0200 (CEST)
From: Test <[email protected]>
To: "[email protected]" <[email protected]>
Subject: can
Thread-Topic: can
Thread-Index: AQHU7Qt7FsBD4dMMv0S8fIYyFhmRWQ==
Date: Sun, 7 Apr 2019 06:31:07 +0000
Message-ID: <[email protected]>
Accept-Language: de-DE, en-US
Content-Language: de-DE
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.188.15.32]
Content-Type: multipart/alternative;
                boundary="_000_10c4f38c658b4a0c8dd7887d75ae5d7d_"
MIME-Version: 1.0
X-purgate: clean
X-purgate-type: clean.almost-empty
X-purgate-ID: 151534::1554618654-000004F5-1A665F12/14/0
Envelope-To: <[email protected]>
X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3;
X-Spam-Flag: NO

顺便说一下,虚拟解决方案对我来说是最好的,因为服务器的第二个功能是自动回复,我可以很容易地通过虚拟实现。

virtual
[email protected]  [email protected],[email protected]@autoreply.local
transport
autoreply.local autoreply:
master.cf
smtp      inet  n       -       n       -       -       smtpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp

relay     unix  -       -       n       -       -       smtp
        -o smtp_fallback_relay=

showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
autoreply  unix  -       n       n       -       -       pipe
  flags= user=nobody argv=/etc/postfix/autoreply/autoreply.sh ${sender} ${mailbox}

我在标题中看到此内容:收件人:”[电子邮件保护]“问题是我该如何改变它?

答案1

标头的问题是 main.cf 中缺少一个参数:

main.cf
local_header_rewrite_clients = static:all

不幸的是,这个解决方案无法使用虚拟功能。为了生成自动回复功能的任务,我添加了一个 BCC 收件人文件:

main.cf
recipient_bcc_maps = hash:$config_directory/bcc
bcc
[email protected]    [email protected]@autoreply.local

如上所述,传输中的 autoreply.local 被分配给 master.cf 中定义的脚本。参数 ${mailbox} 将剪切域 (@autoreply.local),因此传输的脚本的值为:

...autoreply.sh ${sender} ${mailbox}
...autoreply.sh sender@mailcomes_from.tld [email protected] 

邮件内容将通过标准输入传输到脚本。

相关内容