zhltom 发表于 2015-11-25 11:27:29

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: p218WjqH030935: to=*@*.com, delay=00:07:31, xdelay=00:00:00, mailer=relay, pri=139557, relay= , dsn=

4.0.0, stat=Deferred: Connection refused by

原来是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.
页: [1]
查看完整版本: phpmailer使用sendmail发送邮件