<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服务器上不起作用

        PHP mail function not working on Centos server(PHP邮件功能在Centos服务器上不起作用)
          <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服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      <tbody id='M7bhG'></tbody>
                    <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>