簡體   English   中英

使用xampp在本地發送電子郵件到gmail帳戶,沒有錯誤,但是電子郵件沒有到達

[英]sending email to gmail account locally with xampp, no error but the email does not arrive

如在主題..!

我將文件配置如下

在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服務器。 但是,您可以像這樣在本地安裝一台簡單的SMTP服務器。

在某些網絡中,這將允許您從xampp本地將郵件發送到本地安裝的SMTP服務器,再從那里發送到Internet。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM