![PostFix 配置和 PHP](https://linux22.com/image/641560/PostFix%20%E9%85%8D%E7%BD%AE%E5%92%8C%20PHP.png)
我正在尝试使用 PHP 邮件函数在服务器上发送电子邮件(服务器只应该发送电子邮件而不接收任何电子邮件)。PHP 邮件函数返回电子邮件已发送,但邮件实际上并未发送。在 mail.log 中,我看到以下错误。
Sep 13 14:32:32 www postfix/master[7851]: terminating on signal 15
Sep 13 14:32:32 www postfix/master[8018]: daemon started -- version 2.9.6, configuration /etc/postfix
Sep 13 14:32:35 www postfix/pickup[8024]: 2FE12E084: uid=33 from=<www-data>
Sep 13 14:32:35 www postfix/cleanup[8041]: 2FE12E084: message-id=<[email protected]>
Sep 13 14:32:35 www postfix/qmgr[8025]: 2FE12E084: from=<[email protected]>, size=1019, nrcpt=1 (queue active)
Sep 13 14:32:35 www postfix/smtp[8043]: warning: relayhost configuration problem
Sep 13 14:32:35 www postfix/smtp[8043]: 2FE12E084: to=<[email protected]>, relay=none, delay=0.02, delays=0.01/0.01/0/0, dsn=4.3.5, status=deferred (mail for mydomain.com loops back to myself)
以下是 PostFix 配置:
myhostname = www.mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.localdomain, , localhost
relayhost = $mydomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
myorigin = $mydomain
inet_protocols = all
relay_domains = mydomain.com
答案1
错误消息提供了所有需要的信息warning: relayhost configuration problem
您不能将$mydomain
其用作中继主机。您应该输入一个 IP 或 FQDN 到应该中继所有邮件的服务器(或者,如果您没有中继,则将中继主机设置留空)。