Postfix重写一些电子邮件

我pipe理一个域的托pipe(让我们说,发送domain.com)。 该机器未连接到公共领域(因为它承载更多域),主机名是albergues02.resolve.com。 Sendingdomain.com是一个WordPress的应用程序

它安装了Postfix,允许本地应用程序发送电子邮件。 它没有关联的MXlogging。 我知道这可能是一个问题,但客户端并不重要,因为他只把电子邮件发送给一个缩小的组,并且一直在运行(我们刚刚将另一台IP上的主机迁移到了另一台机器上)。 我试图避免重写,但

事实是:

PHP mail()命令将FROM更改为[email protected]

Jul 9 13:51:02 albergues02 sendmail[919]: q69Bp2F1000919: from=apache, size=148, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost Jul 9 13:51:02 albergues02 postfix/smtpd[921]: connect from localhost[127.0.0.1] Jul 9 13:51:02 albergues02 postfix/smtpd[921]: D7B0960E77: client=localhost[127.0.0.1] Jul 9 13:51:02 albergues02 postfix/cleanup[924]: D7B0960E77: message-id=<[email protected]> Jul 9 13:51:02 albergues02 postfix/qmgr[787]: D7B0960E77: from=<[email protected]>, size=607, nrcpt=1 (queue active) Jul 9 13:51:02 albergues02 sendmail[919]: q69Bp2F1000919: [email protected], ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30148, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as D7B0960E77) Jul 9 13:51:02 albergues02 postfix/smtpd[921]: disconnect from localhost[127.0.0.1] 

如果我从login页面“记住我的密码”,邮件就会变好(FROM being being being [email protected]):

 Jul 9 13:55:23 albergues02 postfix/smtpd[938]: connect from localhost[::1] Jul 9 13:55:23 albergues02 postfix/smtpd[938]: 51BB260E79: client=localhost[::1] Jul 9 13:55:23 albergues02 postfix/cleanup[942]: 51BB260E79: message-id=<[email protected]> Jul 9 13:55:23 albergues02 postfix/qmgr[787]: 51BB260E79: from=<[email protected]>, size=968, nrcpt=1 (queue active) Jul 9 13:55:23 albergues02 postfix/smtpd[938]: disconnect from localhost[::1] Jul 9 13:55:23 albergues02 postfix/smtp[943]: 51BB260E79: to=<[email protected]>, relay=vmail.mycompany.es[217.xxx.xx.xx]:25, delay=0.19, delays=0.05/0.02/0/0.11, dsn=2.0.0, status=sent (250 ok: Message 39109407 accepted) Jul 9 13:55:23 albergues02 postfix/qmgr[787]: 51BB260E79: removed 

WordPress的通讯发送插件,既不工作,也没有。

Postconf -n显示:

 alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases anvil_rate_time_unit = 1s command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 html_directory = no inet_interfaces = all inet_protocols = all local_header_rewrite_clients = mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man masquerade_domains = !domain.com !domain2.com # All domains that appear in the @domain of the emails sent mydestination = $myhostname, localhost.$mydomain, localhost mydomain = resolve.com myhostname = albergues02.resolve.com mynetworks_style = host newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES remote_header_rewrite_domain = sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtpd_client_connection_count_limit = 30 smtpd_client_connection_rate_limit = 100 smtpd_client_message_rate_limit = 100 smtpd_client_recipient_rate_limit = 100 smtpd_client_restrictions = permit smtpd_error_sleep_time = 1s smtpd_hard_error_limit = 20 smtpd_soft_error_limit = 10 unknown_local_recipient_reject_code = 550 

Sendmail安装在机器上,但服务已停止。

我不知道还有什么要改变/看/configuration。 我们的目标是让postfix在不重写FROM地址的情况下中继所有来自本地主机的邮件。

我不同意你的说法,即sendmail没有运行。 上面的日志文件显示,它接受了来自Apache的电子邮件,并将其转发给Postfix。 如果没有运行,则不会写入邮件日志。 它也不会有PID 919。

由于Sendmail和Postfix做同样的事情,你真的只想要其中之一。 就我个人而言,我发现Postfix更容易处理。

我也认为你以两种不同的方式发送来自PHP的邮件,这是你的“重写”问题的根源。 其中一种方法是使用/usr/bin/sendmail二进制文件(这是PHP mail()命令的默认文件),另一种方法是通过连接到端口25上的localhost和SMTP进行通信。 据推测,这是与像SwiftMail或类似的包完成的。

Postfix使用与Sendmail版本相同的接口安装自己的/usr/bin/sendmail二进制文件(或者在它的位置符号链接它自己的版本),但是如果sendmail的sendmail在那里,用这个二进制文件发送的邮件将进入Sendmail系统。

我的build议是卸载Sendmail Postfix,然后重新安装Postfix。 这将确保正确的二进制文件位于正确的位置。