我已经在我的机器上将 PostFix 配置为空客户端,正如它所说这里。
但有些邮件被退回了。我检查了日志,发现“发件人”的值等于机器上的脚本用户名,而不是电子邮件中的电子邮件地址:
Apr 25 13:12:22 server2 postfix/qmgr[1598]: C3937504B8049: from=<[email protected]>, size=2041, nrcpt=1 (queue active)
Apr 25 13:12:23 server2 postfix/qmgr[1598]: 0F175504B804A: from=<>, size=3956, nrcpt=1 (queue active)
Apr 25 13:12:50 server2 postfix/pickup[1597]: 23967151C8001: uid=528 from=<gsmbaza>
Apr 25 13:12:50 server2 postfix/qmgr[1598]: 23967151C8001: from=<[email protected]>, size=5223, nrcpt=1 (queue active)
Apr 25 13:12:50 server2 postfix/qmgr[1598]: A4970504B8049: from=<>, size=7046, nrcpt=1 (queue active)
Apr 25 13:13:43 server2 postfix/pickup[1597]: A8DC5504B8049: uid=501 from=<vipsup>
Apr 25 13:13:43 server2 postfix/qmgr[1598]: A8DC5504B8049: from=<[email protected]>, size=2029, nrcpt=1 (queue active)
Apr 25 13:13:44 server2 postfix/qmgr[1598]: EEBDE504B804A: from=<>, size=3926, nrcpt=1 (queue active)
Apr 25 13:14:20 server2 postfix/pickup[1597]: 0743B504B8049: uid=501 from=<vipsup>
Apr 25 13:14:20 server2 postfix/qmgr[1598]: 0743B504B8049: from=<[email protected]>, size=2036, nrcpt=1 (queue active)
Apr 25 13:14:21 server2 postfix/pickup[1597]: 194FC504B804D: uid=528 from=<gsmbaza>
Apr 25 13:14:21 server2 postfix/qmgr[1598]: E5E17504B804A: from=<>, size=3937, nrcpt=1 (queue active)
Apr 25 13:14:22 server2 postfix/qmgr[1598]: 194FC504B804D: from=<[email protected]>, size=6419808, nrcpt=1 (queue active)
Apr 25 13:14:22 server2 postfix/qmgr[1598]: 9F595504B8045: from=<>, size=2542, nrcpt=1 (queue active)
Apr 25 13:15:12 server2 postfix/pickup[1597]: D9879504B8045: uid=528 from=<gsmbaza>
Apr 25 13:15:12 server2 postfix/qmgr[1598]: D9879504B8045: from=<[email protected]>, size=722, nrcpt=1 (queue active)
Apr 25 13:15:13 server2 postfix/qmgr[1598]: 29CA1504B8049: from=<>, size=2620, nrcpt=1 (queue active)
电子邮件被退回如下:
Apr 25 13:17:24 server2 postfix/pickup[4137]: 2F33F504B8045: uid=501 from=<vipsup>
Apr 25 13:17:24 server2 postfix/cleanup[4229]: 2F33F504B8045: message-id=<[email protected]>
Apr 25 13:17:24 server2 postfix/qmgr[1598]: 2F33F504B8045: from=<[email protected]>, size=2033, nrcpt=1 (queue active)
Apr 25 13:17:24 server2 postfix/smtp[4231]: 2F33F504B8045: to=<[email protected]>, relay=mx.yandex.ru[93.158.134.89]:25, delay=0.47, delays=0.27/0/0.12/0.08, dsn=5.7.1, status=bounced (host mx.yandex.ru[93.158.134.89] said: 550 5.7.1 No such user! (in reply to RCPT TO command))
如何正确设置 Postfix?
电子邮件由 php 脚本使用“sendmail”二进制文件(postfix 替代品)发送。
PostFix 配置:
[root@server2 log]# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
debug_peer_list = 127.0.0.1
html_directory = no
inet_interfaces = loopback-only
local_transport = error:local delivery is disabled
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
答案1
要设置发件人:电子邮件地址,您需要使用二进制-f
选项sendmail
。
第二次退回可能是由于relay_host
指向不为您的服务器中继邮件的服务器(mx.yandex.ru)造成的。