2013-03-23 104 views
0

我可以使用XAMPP發送電子郵件嗎?目前我在XAMPP中運行Mercury作爲郵件服務器。使用xampp發送電子郵件

我想在筆記本電腦上測試2小時後發送電子郵件所需的應用程序。我一直在嘗試使用mail函數發送電子郵件,但我沒有收到任何郵件。

+1

@DarkCthulhu還有什麼我需要除了從'xampp'控制面板 – saplingPro 2013-03-23 07:26:06

+0

開始'mercury'您應該使用專用的做郵件庫[ 1] [2]而不是php的郵件功能發送郵件。另外,您應該使用經過驗證的帳戶(例如gmail SMTP),否則您的電子郵件可能會被標記爲垃圾郵件。 [1] http://swiftmailer.org/ [2] http://phpmailer.worxware.com/ – shachibista 2013-03-23 07:53:29

回答

0

我認爲這將有助於:

編輯php.ini(XAMPP \ PHP \ php.ini中)。搜索[郵件功能]並相應地更改這些參數。

SMTP = smtp.gmail.com 
smtp_port = 587 
sendmail_from = [your_gmail_username]@gmail.com 
Note: this gmail account will be used to send the email 
sendmail_path = 「\」D:\xampp\sendmail\sendmail.exe\」 -t」 

注:我沒有安裝我xampp at D:\xampp 編輯您的sendmail.ini (xampp\sendmail\sendmail.ini) 評論的「Mercury」 and 「A free mail service example」內容,如下圖所示:

# Mercury 
#account Mercury 
#host localhost 
#from [email protected] 
#auth off 

# A freemail service example 
#account Hotmail 
#tls on 
#tls_certcheck off 
#host smtp.live.com 
#from [exampleuser]@hotmail.com 
#auth on 
#user [exampleuser]@hotmail.com 
#password [examplepassword] 
  1. 添加,通過它您要發送你的郵件帳戶。在我的例子我已配置Gmail帳戶,如下所示:

    帳戶的Gmail TLS上 tls_certcheck關閉 主機smtp.gmail.com 從[your_gmail_username] @ gmail.com AUTH上 用戶[your_gmail_username] @ gmail.com 密碼[your_gmail_password]

    端口如下所示587

  2. 設置默認帳戶到Gmail:

    帳戶默認:Gmail的

代碼here