【问题标题】:sending email to gmail account locally with xampp, no error but the email does not arrive使用xampp在本地向gmail帐户发送电子邮件,没有错误但电子邮件未到达
【发布时间】:2012-07-25 09:04:42
【问题描述】:

如主题..!

我的文件配置如下

在 php.ini 中

  SMTP =smtp.gmail.com
  smtp_port = 587
  sendmail_from = my adress@gmail.com
  sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

在 sendmail.ini 中

    smtp_server=smtp.gmail.com
    smtp_port=587
    smtp_ssl=tls
    auth_username=(my adress @gmail.com)
    auth_password=( here my gamil account password )

要清楚,你可以在这里看到我的 php 代码!

      $headers = "MIME-Version: 1.0" . "\r\n";
      $headers .= "Content-type: text/html; charset=iso-8859-1"."\r\n";
      $headers .="From: my adress @gmail.com"."\r\n";

       $subject = "Your New Password";
       $message = "Your new password is as follows:
        ----------------------------
        Password: $emailpassword
         ----------------------------
        Please make note this information has been encrypted into our database 

        This email was automatically generated."; 



      if(!mail($forgotpassword, $subject, $message, $headers)){
         die ("Sending Email Failed, Please Contact Site Admin! ($site_email)");
      }else{
           print'New Password Sent!.';
     } 

我发送时得到的是新密码发送!

没有错误 就像真的已经发送了一样 但是当我检查电子邮件时没有消息!

注意:我在 windows-7 上运行

谢谢。

【问题讨论】:

  • 本地不允许联系 gmail SMTP 服务器。您只能访问您自己的互联网提供商的 SMTP 服务器。
  • @RTB 谢谢..那么,我想我会推迟测试,直到我将它上传到服务器

标签: php windows-7 smtp gmail xampp


【解决方案1】:

本地不允许您联系 gmail SMTP 服务器。您只能访问您自己的互联网提供商的 SMTP 服务器。但是,您可以在本地安装一个简单的 SMTP 服务器 like this one

在某些网络中,这将允许您将邮件从 xampp 本地发送到本地安装的 SMTP 服务器,然后从那里发送到 Internet。

【讨论】:

  • 谢谢!但你能告诉我如何配置它吗?在 php.ini 中,因为我是新手:$
  • 谢谢!但你能告诉我如何配置它吗?在 php.ini 中,因为我是新手:$
  • 无需配置 php.ini 只需使用这样的库:phpmailer.worxware.com/index.php 这也会为您生成所有头代码。这样可以节省大量编码。
猜你喜欢
  • 1970-01-01
  • 2013-04-25
  • 2011-12-15
  • 2012-03-30
  • 2016-07-12
  • 2013-12-19
  • 2016-04-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多