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

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

      2. php函数mail()不起作用

        php function mail() isn#39;t working(php函数mail()不起作用)
        <tfoot id='7nWO9'></tfoot>

              <legend id='7nWO9'><style id='7nWO9'><dir id='7nWO9'><q id='7nWO9'></q></dir></style></legend>

              <small id='7nWO9'></small><noframes id='7nWO9'>

            1. <i id='7nWO9'><tr id='7nWO9'><dt id='7nWO9'><q id='7nWO9'><span id='7nWO9'><b id='7nWO9'><form id='7nWO9'><ins id='7nWO9'></ins><ul id='7nWO9'></ul><sub id='7nWO9'></sub></form><legend id='7nWO9'></legend><bdo id='7nWO9'><pre id='7nWO9'><center id='7nWO9'></center></pre></bdo></b><th id='7nWO9'></th></span></q></dt></tr></i><div id='7nWO9'><tfoot id='7nWO9'></tfoot><dl id='7nWO9'><fieldset id='7nWO9'></fieldset></dl></div>
                <bdo id='7nWO9'></bdo><ul id='7nWO9'></ul>
                    <tbody id='7nWO9'></tbody>
                • 本文介绍了php函数mail()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 php 编码中使用了 mail() 函数,但我没有发送任何邮件.在继续之前,我想详细说明使用 mail() 函数的上下文.

                  I used mail() function in php coding but I failed to send any mail. Before proceeding ahead I want to elaborate the context of using the mail() function.

                  我没有托管我的网站,所以它位于本地主机上.我确实设置了 smtp、端口 sendmail_path 等.

                  I didnt host my site so it is on localhost. I did set smtp, port sendmail_path etc.

                  经过大量搜索,我似乎需要下载一个邮件服务器.我下载了一个免费的 sendmail 服务器,并按照网站的建议对其进行了配置.然而,一切都是徒劳的,而且有人告诉我,在我不仅在本地主机上托管我的网站之前,我不能使用邮件功能.请指导我.

                  After searching a lot I it seems that I need to download a mail server. I downloaded a sendmail server that is free and configured it as the site suggested. However, all in vain moreover, someone told me that I can't use mail function until I host my site not only on localhost. Please guide me.

                  <?php
                     $from = "oooo@hotmail.com"; // sender
                     $subject = " My cron is working";
                     $message = "My first Cron  :)";
                  
                     // message lines should not exceed 70 characters (PHP rule), so wrap it
                  
                     $message = wordwrap($message, 70);
                  
                     // send mail
                  
                     ini_set("SMTP","localhost");
                     ini_set("smtp_port","25");
                     ini_set("sendmail_from","00000@gmail.com");
                     ini_set("sendmail_path", "C:wampinsendmail.exe -t");
                  
                     mail("jXXXXXX@gmail.com",$subject,$message,"From: $from
                  ");
                  
                     echo "Thank you for sending us feedback";
                  
                  ?>
                  

                  这是我的 sendmail 配置文件:

                  this my sendmail configuration file:

                  smtp_server=smtp.gmail.com
                  smtp_port=587
                  smtp_ssl=auto
                  
                  ;default_domain=domain.com
                  auth_username=jxxxx@gmail.com
                  auth_password=8888
                  
                  force_sender=j*****@gmail.com
                  
                  ( ! ) SCREAM: Error suppression ignored for
                  ( ! ) Warning: mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to      mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot;    setting in php.ini or use ini_set() in C:wampwww	est.php on line 20
                  

                  推荐答案

                  我觉得你配置不正确,

                  如果您使用的是 XAMPP,那么您可以轻松地从 localhost 发送邮件.

                  if you are using XAMPP then you can easily send mail from localhost.

                  例如,您可以配置 C:xamppphpphp.inic:xamppsendmailsendmail.ini 让 gmail 发送邮件.

                  for example you can configure C:xamppphpphp.ini and c:xamppsendmailsendmail.ini for gmail to send mail.

                  C:xamppphpphp.ini 中找到 extension=php_openssl.dll 并从该行的开头删除分号以使 SSL 适用于 gmail对于本地主机.

                  in C:xamppphpphp.ini find extension=php_openssl.dll and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.

                  在php.ini文件中找到[mail function]并修改

                  in php.ini file find [mail function] and change

                  SMTP=smtp.gmail.com
                  smtp_port=587
                  sendmail_from = my-gmail-id@gmail.com
                  sendmail_path = "C:xamppsendmailsendmail.exe -t"
                  

                  (仅使用上述发送邮件路径即可)

                  (use the above send mail path only and it will work)

                  现在打开 C:xamppsendmailsendmail.ini.将 sendmail.ini 中的所有现有代码替换为以下代码

                  Now Open C:xamppsendmailsendmail.ini. Replace all the existing code in sendmail.ini with following code

                  [sendmail]
                  
                  smtp_server=smtp.gmail.com
                  smtp_port=587
                  error_logfile=error.log
                  debug_logfile=debug.log
                  auth_username=my-gmail-id@gmail.com
                  auth_password=my-gmail-password
                  force_sender=my-gmail-id@gmail.com
                  

                  现在你已经完成了!创建带有邮件功能的php文件并从本地主机发送邮件.

                  Now you have done!! create php file with mail function and send mail from localhost.

                  更新

                  首先,确保您的 PHP 安装支持 SSL(在 phpinfo() 的输出中查找openssl"部分).

                  First, make sure you PHP installation has SSL support (look for an "openssl" section in the output from phpinfo()).

                  您可以在 PHP.ini 中设置以下设置:

                  You can set the following settings in your PHP.ini:

                  ini_set("SMTP","ssl://smtp.gmail.com");
                  ini_set("smtp_port","465");
                  

                  这篇关于php函数mail()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 服务器发送电子邮件时,电子邮件进入垃圾邮件)
                      <tbody id='sz3Fq'></tbody>
                  1. <small id='sz3Fq'></small><noframes id='sz3Fq'>

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

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

                        1. <tfoot id='sz3Fq'></tfoot>