加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 如何为发件人地址配置真实域名

发布时间:2020-12-13 18:10:02 所属栏目:Linux 来源:网络整理
导读:我尝试使用php mail()函数发送电子邮件,但它以某种方式失败,抱怨需要一个真正的域名.在maillog中观察到以下情况: sendmail 4984 r25984: from=apache,size=273,class=0,nrcpts=1, msgid=201.r25@localhost.localdomain,relay=apache@localhost sendmail 498
我尝试使用php mail()函数发送电子邮件,但它以某种方式失败,抱怨需要一个真正的域名.在maillog中观察到以下情况:

sendmail 4984 r25984: from=apache,size=273,class=0,nrcpts=1,
msgid=<201.r25@localhost.localdomain>,relay=apache@localhost
sendmail 4985 r25985: ruleset=check_mail,
arg1=,relay=mydomain.com [127.0.0.1],
reject=553 5.5.4 … Real domain name
required for sender address
sendmail 4984 r25984:
to=external@server.com,ctladdr=apache (48/48),delay=00:00:01,
xdelay=00:00:00,mailer=relay,pri=30273,relay=[127.0.0.1]
[127.0.0.1],dsn=5.6.0,stat=Data format error
sendmail 4984
r25984: r25984: DSN: Data format error

只要logrotate出现问题,cron就可以向external@server.com发送电子邮件.我不确定为什么php无法这样做.我尝试使用以下命令更改`sendmail.mc中的默认配置:

MASQUERADE_AS(`mydomain.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MASQUERADE_DOMAIN(mycom)dnl

但是,它似乎没有任何影响.已经设置了php邮件功能中地址的标题.我还确保启用了SELinux httpd_can_sendmail.我还需要做些什么才能收到邮件?

解决方法

我想我刚解决了.我在/ etc / hosts中有以下内容:
127.0.0.1 www.mydomain.com test.mydomain.com
127.0.0.1 cdn.mycdn.com
127.0.0.1 localhost.localdomain localhost myserver.com

我需要的是将myserver.com放在localhost.localdomain的前面,以便sendmail认为它使用真实域发送电子邮件.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读