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了。


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