<small id='zeR9x'></small><noframes id='zeR9x'>

        <i id='zeR9x'><tr id='zeR9x'><dt id='zeR9x'><q id='zeR9x'><span id='zeR9x'><b id='zeR9x'><form id='zeR9x'><ins id='zeR9x'></ins><ul id='zeR9x'></ul><sub id='zeR9x'></sub></form><legend id='zeR9x'></legend><bdo id='zeR9x'><pre id='zeR9x'><center id='zeR9x'></center></pre></bdo></b><th id='zeR9x'></th></span></q></dt></tr></i><div id='zeR9x'><tfoot id='zeR9x'></tfoot><dl id='zeR9x'><fieldset id='zeR9x'></fieldset></dl></div>
        <legend id='zeR9x'><style id='zeR9x'><dir id='zeR9x'><q id='zeR9x'></q></dir></style></legend>
          <bdo id='zeR9x'></bdo><ul id='zeR9x'></ul>
      1. <tfoot id='zeR9x'></tfoot>
      2. PHP邮件功能在Centos服务器上不起作用

        时间:2024-04-13
          <tbody id='uKfAH'></tbody>
          <bdo id='uKfAH'></bdo><ul id='uKfAH'></ul>

            <tfoot id='uKfAH'></tfoot>

                  <small id='uKfAH'></small><noframes id='uKfAH'>

                  <legend id='uKfAH'><style id='uKfAH'><dir id='uKfAH'><q id='uKfAH'></q></dir></style></legend>

                  <i id='uKfAH'><tr id='uKfAH'><dt id='uKfAH'><q id='uKfAH'><span id='uKfAH'><b id='uKfAH'><form id='uKfAH'><ins id='uKfAH'></ins><ul id='uKfAH'></ul><sub id='uKfAH'></sub></form><legend id='uKfAH'></legend><bdo id='uKfAH'><pre id='uKfAH'><center id='uKfAH'></center></pre></bdo></b><th id='uKfAH'></th></span></q></dt></tr></i><div id='uKfAH'><tfoot id='uKfAH'></tfoot><dl id='uKfAH'><fieldset id='uKfAH'></fieldset></dl></div>
                1. 本文介绍了PHP邮件功能在Centos服务器上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 centos 服务器,必须将邮件发送给用户,所以我从一台服务器复制了我的运行代码并在这里使用它,但它不发送邮件.

                  I am using centos Server and have to send the mail to the user so i copied running code of mine from one server and used it in here, but it is not sending mails.

                  代码是:

                                  $to = $email; //writing mail to the user
                                  $subject = "Hii";
                                  $message = "<table>
                                  <tr><td> Hello ".$email.",</td></tr>
                                  <tr><td> Some Text </td></tr>
                                  <tr><td> Some Text </td></tr>
                                  <tr><td> Some Text </td></tr>
                                  <tr><td> Some Text </td></tr>
                                  </table>" ;
                                  $from = "example@domain.com";
                                  // To send HTML mail, the Content-type header must be set
                                      $headers  = 'MIME-Version: 1.0' . "
                  ";
                                      $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
                  ";
                                  // Additional headers
                                  $headers .= 'From: Team <example@domain.com>' . "
                  ";
                  
                                  if(mail($to,$subject,$message,$headers))
                                  {
                                      echo "0";// mail sent Successfully.
                                  }
                                  else
                                  {
                                      echo "1";
                                  }
                  

                  它总是打印 1.相同的代码在其他项目上运行良好.请指导我在这里也能做些什么来启用它?任何帮助将不胜感激!

                  It always print 1. Same code running fine on other project. Please guide me what i can do to enable it here too? Any help will be highly appreciated!

                  推荐答案

                  安装 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.

                  这篇关于PHP邮件功能在Centos服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:nginx 和 php-fpm 套接字所有者 下一篇:如何使 APC(PHP 缓存)工作?

                  相关文章

                2. <i id='M7bhG'><tr id='M7bhG'><dt id='M7bhG'><q id='M7bhG'><span id='M7bhG'><b id='M7bhG'><form id='M7bhG'><ins id='M7bhG'></ins><ul id='M7bhG'></ul><sub id='M7bhG'></sub></form><legend id='M7bhG'></legend><bdo id='M7bhG'><pre id='M7bhG'><center id='M7bhG'></center></pre></bdo></b><th id='M7bhG'></th></span></q></dt></tr></i><div id='M7bhG'><tfoot id='M7bhG'></tfoot><dl id='M7bhG'><fieldset id='M7bhG'></fieldset></dl></div>

                    <small id='M7bhG'></small><noframes id='M7bhG'>

                    <legend id='M7bhG'><style id='M7bhG'><dir id='M7bhG'><q id='M7bhG'></q></dir></style></legend>
                    <tfoot id='M7bhG'></tfoot>
                    • <bdo id='M7bhG'></bdo><ul id='M7bhG'></ul>