且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP邮件功能在Centos服务器上不起作用

更新时间:2023-08-24 12:45:52

安装 sendmail* 并运行以下命令后:

After installing sendmail* and running the following commands:

[root@sendmail ~]# yum install sendmail*
[root@sendmail mail]# yum install dovecot
[root@sendmail mail]# cd /etc/mail/
[root@sendmail mail]# vi local-host-names
# local-host-names - include all aliases for your machine here.
example.com
[root@sendmail mail]# vi /etc/dovecot.conf
protocols = imap pop3 //uncomment
[root@sendmail mail]# m4 sendmail.mc > sendmail.cf
[root@sendmail mail]# make
[root@sendmail mail]# /etc/init.d/sendmail start
[root@sendmail mail]# /etc/init.d/saslauthd start
[root@sendmail mail]# /etc/init.d/dovecot start
[root@sendmail mail]# chkconfig sendmail on
[root@sendmail mail]# chkconfig dovecot on
[root@sendmail mail]# chkconfig saslauthd on

我仍然有同样的问题.我检查了我的 /var/log/maillog 并看到了一个错误:

I still had the same issue. I checked my /var/log/maillog and saw an error:

My unqualified host name (domain) unknown; sleeping for retry

经过更多搜索,我将 /etc/hosts 从:

After more searching, I changed /etc/hosts from:

127.0.0.1     localhost localhost.localdomain domain
ip.ip.ip.ip  domain localhost 

到:

 127.0.0.1   localhost.localdomain localhost domain
 ip.ip.ip.ip  localhost domain  

现在邮件功能可以正常工作了.

and now the mail function is now working fine.