AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 724576
Accepted
ETL
ETL
Asked: 2015-09-25 07:15:20 +0800 CST2015-09-25 07:15:20 +0800 CST 2015-09-25 07:15:20 +0800 CST

完全更改 Postfix 上的收件人

  • 772

我想要实现的是,任何收到的电子邮件[email protected]都会被重写[email protected]并传递到[email protected].

两者都为交付给备用收件人canonical_maps而工作。virtual_alias_maps当我阅读文档时,它告诉我使用canonical_maps,进行cleanup了完全重写。

但是,在实践中,电子邮件仍然具有to原始收件人的电子邮件。因此,当查看 bob 邮箱中的电子邮件时,它会显示给 joe 的电子邮件。

不知何故,我觉得我在这里遗漏了一些东西。

配置:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
bounce_queue_lifetime = 2d
canonical_maps = hash:/etc/postfix/canonical
config_directory = /etc/postfix
header_checks = pcre:/etc/postfix/header_checks
home_mailbox = Maildir/
html_directory = /usr/share/doc/postfix/html
inet_interfaces = all
mailbox_size_limit = 0
maximal_queue_lifetime = 4d
milter_default_action = accept
milter_protocol = 2
mydestination = ...
myhostname = ...
mynetworks = ...
myorigin = /etc/mailname
non_smtpd_milters = inet:localhost:8891
readme_directory = /usr/share/doc/postfix
recipient_delimiter = +
relayhost =
smtp_fallback_relay = ...
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_milters = inet:localhost:8891
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recipient_access        permit_mynetworks       reject_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = hash:/etc/postfix/virtual

日志:

Sep 25 09:40:30 server1 postfix/smtpd[28285]: connect from mail-la0-f66.google.com[209.85.215.66]
Sep 25 09:40:31 server1 postfix/smtpd[28285]: 7CA784EDB6: client=mail-la0-f66.google.com[209.85.215.66]
Sep 25 09:40:31 server1 postfix/cleanup[28339]: 7CA784EDB6: message-id=<CAJjncucnGM532xhcn37VAwmwQoYEwOUfE_A33-oyJJH5PqPUcA@mail.gmail.com>
Sep 25 09:40:31 server1 postfix/qmgr[7593]: 7CA784EDB6: from=<[email protected]>, size=1813, nrcpt=1 (queue active)
Sep 25 09:40:32 server1 postfix/smtpd[28285]: disconnect from mail-la0-f66.google.com[209.85.215.66]
Sep 25 09:40:32 server1 postfix/smtp[28593]: 7CA784EDB6: enabling PIX workarounds: disable_esmtp delay_dotcrlf for ...[...]]:25
Sep 25 09:40:33 server1 postfix/smtp[28593]: 7CA784EDB6: to=<[email protected]>, orig_to=<[email protected]>, relay=...[...]:25, delay=1.6, delays=0.45/0/0.42/0.73, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 98F729600E)
Sep 25 09:40:33 server1 postfix/qmgr[7593]: 7CA784EDB6: removed
postfix
  • 1 1 个回答
  • 741 Views

1 个回答

  • Voted
  1. Best Answer
    masegaloeh
    2015-09-26T10:57:37+08:002015-09-26T10:57:37+08:00

    从 mail.log 中,看起来您想要重写来自远程客户端的电子邮件。后缀重写的默认设置防止这种情况发生。

    Postfix 重写自述文件的摘录

    Postfix 2.2 版让您可以选择根本不重写来自远程 SMTP 客户端的邮件标头,或者将此类邮件标头中的不完整地址标记为无效。下面是它的工作原理:

    • Postfix 总是重写来自本地 SMTP 客户端和 Postfix sendmail 命令的邮件头,并将其自己的域附加到不完整的地址。该local_header_rewrite_clients参数控制 Postfix 认为本地的 SMTP 客户端(默认情况下,只有本地网络接口地址)。

    • remote_header_rewrite_domain当参数值为空(默认设置)时,Postfix 从不重写来自远程 SMTP 客户端的邮件头地址。

    • 否则,Postfix 会重写来自远程 SMTP 客户端的邮件头,并将remote_header_rewrite_domain值附加到不完整的地址。此功能可用于附加保留域,例如“domain.invalid”,这样不完整的地址就不会被误认为是本地地址。

    因此,最简单的解决方案是不要将参数保留remote_header_rewrite_domain为空值。您需要为此参数提供值,例如

    remote_header_rewrite_domain = domain.invalid
    

    或者您可以使用static:allon 参数local_header_rewrite_clients,因此 postfix 会将所有远程客户端视为本地客户端。

    local_header_rewrite_clients = static:all
    

    来源:Postfix 地址重写官方文档

    • 2

相关问题

  • Postfix 在特定端口上接受邮件

  • 让 Postfix 以两种方式处理垃圾邮件

  • Postfix 或 exim:自动/程序化和转发电子邮件设置

  • 后缀电子邮件地址

  • 什么是最好的开源电子邮件解决方案包

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve