2013-12-11 135 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