phpmailer使用sendmail發送郵件

tail /var/log/maillog日誌錯誤
1.NOQUEUE: SYSERR(apache): can not chdir(/var/spool/clientmqueue/): Permission denied

chown smmsp:smmsp /var/spool/clientmqueue
chmod 770 /var/spool/clientmqueue
chgrp smmsp /usr/sbin/sendmail
chmod g+s /usr/sbin/sendmail

另外

/usr/sbin/setsebool -P httpd_can_sendmail=on

原因是apache默認並不運行sendmail。你必須手動開啓。

2. Mar 1 16:40:16 localhost sm-msp-queue[31173]: p218WjqH030935: to=*@*.com, delay=00:07:31, xdelay=00:00:00, mailer=relay, pri=139557, relay=[127.0.0.1] [127.0.0.1], dsn=
4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
原來是sendmail在Fedora中默認的配置有問題,
修改/etc/mail/sendmail.mc文件:

DAEMON_OPTIONS(`Port=smtp,Name=MTA’)dnl 
dnl #DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl  

把原來的指定Addr註釋掉,
原來這種配置只能向本機地址發送郵件,
然後重新加載配置文件:

make -C /etc/mail  

重啓服務:

service sendmail restart 

使用mail發信就正常了。
3. make -C /etc/mail報錯:

#make -C /etc/mail
make: Entering directory '/etc/mail'
WARNING: 'sendmail.mc' i modified. Please install package sendmail-cf to update your configuration.

解決:
Your system likely came with a default sendmail.mc and sendmail.cf file in /etc/mail. These are part of package called sendmail.

However, the files to actually make sendmail.mc into a sendmail.cf are part of a separate package called sendmail-cf.

The message is telling you in essence it can't make the file because you don't have the sendmail-cf package installed.

If you're on RedHat/CentOS/Fedora you can likely just do "yum install sendmail-cf" to get the latest package installed. (RHEL 4 and earlier use up2ate rather than yum.)

For other distros you'd use their package management tools for downloading and installing the sendmail-cf package.

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