1. 程式人生 > >Centos系統sendmail傳送郵件很慢的解決方法

Centos系統sendmail傳送郵件很慢的解決方法

安裝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
 
修改方法依然是用vi命令,

然後重啟sendmail服務:service sendmail restart

http://blog.sina.com.cn/s/blog_a655f0ce01016ehe.html