Postfix + php 将发送到本地域的电子邮件地址翻译为 [email protected]

Postfix + php 将发送到本地域的电子邮件地址翻译为 [email protected]

我的第一个问题是,如果我没有立即提供足够的信息,请对我投反对票宽容一点 ;-)

我正在运行由 afterburst.com 托管的 VPS,使用 OpenVZ

我成功安装并配置了以下组件:

zpanel (with apache, mysql, php5.3, postfix)
updated successfully to php5.4
running Laravel on secundary webpage (works fine)

使用 php 和 MUA 发送电子邮件效果很好。从 MUA 向本地托管域发送电子邮件效果也很好。

但这是错误:

当我使用 php sendmail 命令向本地托管域发送电子邮件时,电子邮件地址被转换为[电子邮件保护]我相信这与我的 DNS 设置有关,但我尝试了很多方法,但还是找不到正确的答案

我的主机名是

[user@vps ~]# hostname
vps.krause-it-consulting.com

这是我的 postfix 配置(postconf -n):

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
delay_warning_time = 4
disable_vrfy_command = yes
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = vps.$mydomain
mydomain = krause-it-consulting.com
myhostname = vps.krause-it-consulting.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 VPS_IP
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.2.2/README_FILES
recipient_delimiter = +
relay_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-relay_domains_maps                                                                                                                                                      .cf
sample_directory = /usr/share/doc/postfix-2.2.2/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_host_lookup = dns, native
smtp_use_tls = no
smtpd_client_restrictions =
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_helo_required = yes
smtpd_helo_restrictions =
smtpd_recipient_restrictions = permit_sasl_authenticated,        permit_mynetwor                                                                                                                                                      ks,        reject_unauth_destination,        reject_non_fqdn_recipient,        r                                                                                                                                                      eject_unknown_recipient_domain
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions =
smtpd_use_tls = no
soft_bounce = yes
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 550
virtual_alias_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_alias                                                                                                                                                      _maps.cf,                     regexp:/etc/zpanel/configs/postfix/virtual_regexp
virtual_gid_maps = static:12
virtual_mailbox_base = /var/zpanel/vmail
virtual_mailbox_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_                                                                                                                                                      domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mai                                                                                                                                                      lbox_maps.cf
virtual_minimum_uid = 101
virtual_transport = dovecot
virtual_uid_maps = static:101

如果您需要更多信息,请询问,我会添加。

最后我想强调的是只有通过 php 和 sendmail 命令发送的电子邮件才是问题所在这里。其他一切都很好(到目前为止:-))

答案1

考虑到我过去两周一直在处理这个问题,在写下这个问题的细节后,我终于能够修复它了。

实际上是我在 hosts 文件中输入的条目导致了此问题。也许我玩得太过了 :-)

无论如何,问题如下:

127.0.0.1 localhost.localdomain localhost vps.krause-it-consulting.com krause-it-consulting.com hobbyathletes.com

删除我托管域的 2 个附加项后,它就可以正常工作了:正确的行:

 127.0.0.1 localhost.localdomain localhost vps.krause-it-consulting.com 

无论如何,我希望这能够对某些人有所帮助。

相关内容