2013-12-11 64 views
0

我有我的PHP一個問題:我想用XAMPP 我的配置發送簡單的郵件php..I是: 的php.ini: 只有sendmail和mail.add_x_header沒有評論發送郵件用PHP

; For Win32 only. 
; http://php.net/smtp 
;SMTP = smtp.gmail.com 
; http://php.net/smtp-port 
;smtp_port = 587 
sendmail_path = "C:\xampp\sendmail\sendmail.exe\" -t" 
mail.add_x_header = Off 

sendmail.ini:

smtp_server=smtp.gmail.com 
;smtp port (normally 25) 
smtp_port=587 
smtp_ssl=true 
[email protected] 
auth_password=mypassword 

和index.php文件

<?php 
$subject="Hi There!!"; 
$to="[email protected]"; 
$body="This is my demo email sent using PHP on XAMPP"; 
if (mail($to,$subject,$body)) 
echo "Mail sent successfully!"; 
    else 
    echo "Mail not sent!"; 
    ?> 

它運行沒有錯誤,但郵件不來...我的錯誤在哪裏?PLIZ幫助我

+0

您是否有防火牆問題?你有沒有檢查你的PHP日誌? –

+0

你確定你php.ini'sendmail_path =「C:\ xampp \ sendmail \ sendmail.exe \」-t「'看起來不錯嗎?我懷疑你有一個不平衡的報價或一些非反斜槓!試試'sendmail_path = C: /xampp/sendmail/sendmail.exe -t' –

+0

給這個帖子試一試:[這裏](http://stackoverflow.com/questions/4948687/xampp-sendmail-using-gmail-account) – MikeF

回答

1

您的sendmail_path設置中有一個額外的引號。嘗試從改變你的php.ini文件:

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

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

也是你個人的ISP或在工作中這樣做呢?您的端口可能被阻止。此外,雅虎也可以過濾您的電子郵件。可以嘗試添加標題。

+0

什麼標題?反垃圾郵件標題? – Rudie

+0

對於個人ISP – user3093068

+0

PLIZ幫助我的朋友! ! – user3093068