• <legend id='Dbrio'><style id='Dbrio'><dir id='Dbrio'><q id='Dbrio'></q></dir></style></legend>

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

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

        <tfoot id='Dbrio'></tfoot>
        • <bdo id='Dbrio'></bdo><ul id='Dbrio'></ul>

        PHP mail() 函数返回 true,但不发送邮件

        PHP mail() function returns true, but doesn#39;t send mail(PHP mail() 函数返回 true,但不发送邮件)

          <tbody id='jfFSY'></tbody>
        <i id='jfFSY'><tr id='jfFSY'><dt id='jfFSY'><q id='jfFSY'><span id='jfFSY'><b id='jfFSY'><form id='jfFSY'><ins id='jfFSY'></ins><ul id='jfFSY'></ul><sub id='jfFSY'></sub></form><legend id='jfFSY'></legend><bdo id='jfFSY'><pre id='jfFSY'><center id='jfFSY'></center></pre></bdo></b><th id='jfFSY'></th></span></q></dt></tr></i><div id='jfFSY'><tfoot id='jfFSY'></tfoot><dl id='jfFSY'><fieldset id='jfFSY'></fieldset></dl></div>
        <legend id='jfFSY'><style id='jfFSY'><dir id='jfFSY'><q id='jfFSY'></q></dir></style></legend>

        <tfoot id='jfFSY'></tfoot>
              <bdo id='jfFSY'></bdo><ul id='jfFSY'></ul>

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

                1. 本文介绍了PHP mail() 函数返回 true,但不发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道以前有人问过这个问题.

                  I know that this question was asked before.

                  当我调用 PHP mail() 函数时,它返回 true.

                  When I call the PHP mail() function, it returns true.

                  我检查了我的 php.ini(我正在运行 CentOS):

                  I checked my php.ini (I'v running CentOS):

                  SMTP = localhost
                  smtp_port = 25
                  sendmail_path = /usr/sbin/sendmail -t -i
                  mail.add_x_header = On
                  

                  我在一个论坛上看到我必须安装 sendmail.所以我安装了它.现在具有 mail() 功能的网站不再加载.于是我把sendmail去掉了,mail()函数又返回了true,但是没有发送邮件.

                  I read in a forum that I have to install sendmail. So I installed it. Now sites with a mail() function doesn't load anymore. So I removed sendmail, and the mail() function returns true again, but doesn't send the mail.

                  有什么想法吗?

                  推荐答案

                  要发送电子邮件,您需要一个 SMTP 服务器(本地或远程).实际上,您的邮件功能只是将邮件传递到您的 SMTP 服务器,而这才是真正发送您的电子邮件的功能.

                  To send an email you need a SMTP server (local or remote). Actually your mail function just passes the mail to your SMTP server and is this one which really send your email.

                  在你的 php.ini 中出现这一行

                  In your php.ini appears this line

                  sendmail_path = /usr/sbin/sendmail -t -i
                  

                  如果您使用该配置参数(来自 manual):

                  You should be aware if you use that configuration parameter (from manual):

                  如果设置,smtp、smtp_port 和 sendmail_from 将被忽略,并且执行指定的命令.

                  If set, smtp, smtp_port and sendmail_from are ignored and the specified command is executed.

                  但这里最重要的是您只需卸载 sendmail,这样您就可以期待您的邮件无处可去.我知道 sendmail 给你带来了一些问题,可能是配置问题,但现在你的 php.ini 配置是错误的.

                  But the most important thing here is you just uninstall sendmail so you can expect your mail goes nowhere. I know sendmail was giving you some problems, possibly configuration problems, but now your php.ini configuration is wrong.

                  如何解决?

                  • 开始从 php.ini 中删除 sendmail_path 参数.

                  安装一个简单配置的 SMTP 服务器,例如 postfix.

                  Install a simple to configure SMTP server like postfix.

                  验证后缀是否在端口 22 上侦听:

                  Verify postfix is listening at port 22:

                  netstat -lnt

                  netstat -lnt

                  • 尝试从你的 php mail() 函数发送邮件

                    • Try to send a mail from your php mail() function

                      验证您的邮件是否已正确发送(检查您的 /var/log/mail.log/var/log/mail/mail.log 文件)

                      Verify your mail has been sent correctly (check your /var/log/mail.log or /var/log/mail/mail.log files)

                      您也可以验证邮件不在后缀队列中:

                      You also can verify the mail is not in the postfix queue:

                      后队列-f

                      这篇关于PHP mail() 函数返回 true,但不发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                  smtp gmail server php mailer not working(smtp gmail服务器php邮件程序不工作)
                  Email goes in spam when I send it via others SMTP server(当我通过其他 SMTP 服务器发送电子邮件时,电子邮件进入垃圾邮件)
                  • <i id='TIFHJ'><tr id='TIFHJ'><dt id='TIFHJ'><q id='TIFHJ'><span id='TIFHJ'><b id='TIFHJ'><form id='TIFHJ'><ins id='TIFHJ'></ins><ul id='TIFHJ'></ul><sub id='TIFHJ'></sub></form><legend id='TIFHJ'></legend><bdo id='TIFHJ'><pre id='TIFHJ'><center id='TIFHJ'></center></pre></bdo></b><th id='TIFHJ'></th></span></q></dt></tr></i><div id='TIFHJ'><tfoot id='TIFHJ'></tfoot><dl id='TIFHJ'><fieldset id='TIFHJ'></fieldset></dl></div>

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

                        <tbody id='TIFHJ'></tbody>

                      1. <legend id='TIFHJ'><style id='TIFHJ'><dir id='TIFHJ'><q id='TIFHJ'></q></dir></style></legend>
                          <bdo id='TIFHJ'></bdo><ul id='TIFHJ'></ul>

                          <tfoot id='TIFHJ'></tfoot>