linux ci 發郵件 sendmail

發郵件的困難:



2015/3/12 18:15

[root@bogon html]# chown smmsp:smmsp /var/spool/clientmqueue

[root@bogon html]# chmod 2770 /var/spool/clientmqueue

[root@bogon html]# chgrp smmsp /usr/sbin/sendmail

[root@bogon html]# chmod g+s /usr/sbin/sendmail

[root@bogon html]# /usr/sbin/usermod -G smmsp -g apache apache


2015/3/6 18:50

使用CI自帶的發郵件,遇錯誤:Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

sudo yum install postfix , 裝好後仍然一樣,

發現log中: Program mode requires special privileges, e.g., root or TrustedUser.

chmod -R 777 ugc_ci_framework 也不work;

/etc/php.ini 改成sendmail.postfix  , /etc/init.d/httpd restart 重啓了apache php配置生效,log報錯換成:sendmail.postfix: fatal: unable to use my own hostname

在框架外面直接用php的mail(),也是apache報錯:Program mode requires special privileges, e.g., root or TrustedUser.


與此同時,發現maillog也在報錯:

tail -f /var/log/maillog : NOQUEUE: SYSERR(apache): can not chdir(/var/spool/clientmqueue/): Permission denied

sudo chown smmsp:smmsp /var/spool/clientmqueue

sudo /usr/sbin/usermod -G smmsp -g apache apache

重啓apache,也還是不行。。

maillog報錯改變:

NOQUEUE: SYSERR(apache): can not write to queue directory /var/spool/clientmqueue/ (RunAsGid=48, required=51): Permission denied

並且/var/log/httpd/error_log已經不報錯

chmod 777 clientmqueue  郵件就能發送了


此時把clientmqueue換回770,再執行: chmod g+s /usr/sbin/sendmail

就ok了。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章