Centos中sendmail發送郵件很慢的解決方法
centos中用yum安裝sendmail:
yum install sendmail
此時是無法發郵件的,需要修改一下php.ini的配置,調用sendmail:
第一步:輸入 vi /usr/local/php/etc/php.ini
第二步:找到有關sendmail_path的那一行,按i鍵,然后就可以修改代碼了,
第三步:去掉行首注釋(分號;),并改成:sendmail_path = /usr/sbin/sendmail -t –i
第四步:按 Esc鍵——shift+q ——wq(保存退出的意思)
第五步:重啟vps 命令: reboot
重啟后可以發郵件了,但速度很慢,查看一下解析文件:cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
199.193.248.26 wenran
因為sendmail監聽的是127.0.0.1,但卻無法確認主機名weimtv (因為在服務器上/etc/sysconfig/network文件里記錄的HOSTNAME是 wenran),所以發送郵件就非常慢了。那么把 wenran 這個主機名同時也加到127.0.0.1上面,改為:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost wenran
199.193.248.26 wenran
重啟sendmail服務:service sendmail restart
至此,再發送郵件應該會很快了。