主机:centos 7 ,
安装sendmail,启动sendmail,一般就可以了,但是有些同学为什么不行,就是启不动出现如下的情况!那现在如何解决。
yum install sendmail
systemctl start sendmail.service systemctl status sendmail.service ● sendmail.service - Sendmail Mail Transport Agent Loaded: loaded (/usr/lib/systemd/system/sendmail.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2016-05-08 12:22:58 CST; 1min 33s ago Process: 9727 ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG (code=exited, status=0/SUCCESS) Process: 9722 ExecStartPre=/etc/mail/make aliases (code=exited, status=0/SUCCESS) Process: 9720 ExecStartPre=/etc/mail/make (code=exited, status=0/SUCCESS) Main PID: 9730 (sendmail) CGroup: /system.slice/sendmail.service └─9730 sendmail: accepting connection May 08 12:21:58 iZ28xev9g2sZ systemd[1]: Starting Sendmail Mail Transport Agent... May 08 12:21:58 iZ28xev9g2sZ sendmail[9727]: My unqualified host name (iZ28xev9g2sZ) unknown; sleeping for retry May 08 12:22:58 iZ28xev9g2sZ sendmail[9727]: unable to qualify my own domain name (iZ28xev9g2sZ) -- using short name May 08 12:22:58 iZ28xev9g2sZ systemd[1]: PID file /run/sendmail.pid not readable (yet?) after start. May 08 12:22:58 iZ28xev9g2sZ sendmail[9730]: starting daemon (8.14.7): [email protected]:00:00 May 08 12:22:58 iZ28xev9g2sZ systemd[1]: Started Sendmail Mail Transport Agent.
解决方法:其实就是你的主机没有设置hostname
mail发送邮件,默认调用的是sendmail,sendmail发送邮件,必须设置hostname,而hostname不能是一串字符串,而必须是格式正确的域名,例如mail.tome178.com
所以我们的解决方法是修改hostname,一种是临时的,一种是永久的
一般我们可以设置临时的
hostname mail.tome178.com
永久的修改/etc/sysconfig/network
hostname=mail.tome178.com //主机名(没有这行?那就添加这一行吧)
然后运行
hostname mail.tome178.com
然后重启sendmail就可以发送邮件了
● sendmail.service - Sendmail Mail Transport Agent Loaded: loaded (/usr/lib/systemd/system/sendmail.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2016-05-08 12:39:48 CST; 16min ago Process: 9939 ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG (code=exited, status=0/SUCCESS) Process: 9933 ExecStartPre=/etc/mail/make aliases (code=exited, status=0/SUCCESS) Process: 9932 ExecStartPre=/etc/mail/make (code=exited, status=0/SUCCESS) Main PID: 9942 (sendmail) CGroup: /system.slice/sendmail.service └─9942 sendmail: accepting connections May 08 12:41:12 mail.tome178.com sendmail[9965]: u484fBCq009965: from=<[email protected]>, si....1] May 08 12:41:13 mail.tome178.com sendmail[9967]: STARTTLS=client, relay=163mx01.mxmail.netease.co...256 May 08 12:41:14 mail.tome178.com sendmail[9967]: STARTTLS=client, relay=163mx03.mxmail.netease.co...256 May 08 12:41:14 mail.tome178.com sendmail[9967]: u484fBCq009965: to=<[email protected]>, ctladdr=<...74) May 08 12:41:21 mail.tome178.com sendmail[9971]: u484fKXx009971: from=<[email protected]>, si....1] May 08 12:41:21 mail.tome178.com sendmail[9973]: STARTTLS=client, relay=mx3.qq.com., version=TLSv...128 May 08 12:41:24 mail.tome178.com sendmail[9973]: u484fKXx009971: to=<[email protected]>, ctladdr=<r...s ) May 08 12:54:08 mail.tome178.com sendmail[9988]: u484s8IS009988: from=<[email protected]>, si....1] May 08 12:54:09 mail.tome178.com sendmail[9990]: STARTTLS=client, relay=mx3.qq.com., version=TLSv...128 May 08 12:54:09 mail.tome178.com sendmail[9990]: u484s8IS009988: to=<[email protected]>, ctladdr=<r...s ) Hint: Some lines were ellipsized, use -l to show in full.
时间: 2024-10-02 20:38:11