mail慢并超时是由于sendmail慢引起的,  但sendmail慢又如何解决呢?

第一步:当然是查日志:

vim /var/log/maillog

Jul  5 23:26:20 localhost sendmail[1206]: My unqualified host name (localhost) unknown; sleeping for retry
Jul  5 23:27:20 localhost sendmail[1206]: unable to qualify my own domain name (localhost) -- using short name
Jul  5 23:27:20 localhost sendmail[1206]: r65FRKmm001206: from=nobody, size=187, class=0, nrcpts=1, msgid=<201307051527.r65FRKmm001206@localhost>, relay=nobody@localhost
Jul  5 23:27:20 localhost sendmail[1207]: r65FRKBa001207: from=<nobody@localhost>, size=398, class=0, nrcpts=1, msgid=<201307051527.r65FRKmm001206@localhost>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Jul  5 23:27:20 localhost sendmail[1206]: r65FRKmm001206: to=aaa@gmail.com, ctladdr=nobody (99/99), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30187, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (r65FRKBa001207 Message accepted for delivery)
Jul  5 23:27:22 localhost sendmail[1209]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
Jul  5 23:27:25 localhost sendmail[1209]: r65FRKBa001207: to=<aaa@gmail.com>, ctladdr=<nobody@localhost> (99/99), delay=00:00:05, xdelay=00:00:05, mailer=esmtp, pri=120398, relay=gmail-smtp-in.l.google.com. [74.125.129.26], dsn=2.0.0, stat=Sent (OK 1373038045 qn3si5112247pbc.62 - gsmtp)
Jul  5 23:30:01 localhost sendmail[1212]: My unqualified host name (localhost) unknown; sleeping for retry


第二步:在hosts表添加域名

#hostname

vim /etc/hosts

如下添加

::1   localhost localhost.localdomain localhost6 localhost6.localdomain6 你的域名

我的实例:

 ::1   localhost localhost.localdomain localhost6 localhost6.localdomain6 itsmtest.vobi××.cn itsm-demo
 
 root@itsm-demo:/var/www/html/itop.new# service apache2 restart
root@itsm-demo:/var/www/html/itop.new# echo $?
0



我的实例2:没有域名,纯ip地址
root@itsm:/var/www/html# cat /etc/hosts
127.0.0.1    localhost
192.168.200.65    itsm

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback itsm 192.168.200.65
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


如果上面办法还是解决不了

检查下php.ini设置是否正确
cat /etc/php.ini | grep sendmail_path
正确的结果应该类似这样
sendmail_path = sendmail -t -i

检查下sendmail是否安装
which sendmail
正常的结果应该类似这样
/usr/sbin/sendmail

如果上面的路径没有找到sendmail
检查下是否安装了包
yum list installed | grep sendmail