2014-07-07 30 views
0

這是我通過xampp發送郵件的代碼,我修改了xampp中的php.ini和sendmail.ini。運行php後,我沒有收到電子郵件。請幫幫我 。如何修改xampp使用php發送郵件?

的php.ini

[mail function] 

SMTP =smtp.gmail.com <br> 
smtp_port =587 

; For Win32 only. 

;sendmail_from [email protected] 

sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" 

sendmail.ini

smtp_server=smtp.gmail.com 

; smtp port (normally 25) 

smtp_port=587 

[email protected] <br> 
auth_password=password <br> 
[email protected] 

用於發送電子郵件的PHP代碼是這樣的

mail("[email protected]","subject","this is the mail","From:  [email protected]"); 


這是我的PHP代碼。告訴我錯誤?

+0

告訴我們錯誤。你有沒有收到?你檢查了錯誤日誌嗎? –

+0

可能重複的[如何配置XAMPP從本地主機發送郵件?](http://stackoverflow.com/questions/15965376/how-to-configure-xampp-to-send-mail-from-localhost) –

+0

是的它是同一個問題的重複。我跟着它,但仍然無法發送郵件 –

回答

0

我今天也得到了這個錯誤。我在SO中發現了這個工作解決方案。只要改變sendmail.exe文件的兼容模式到Windows XP SP 3

  1. 右鍵單擊sendmail.exe並轉到性質
  2. 改變兼容模式到Windows XP SP 3

你可以在這裏找到Original post