【发布时间】:2013-10-11 06:34:29
【问题描述】:
我想使用mail函数从我的php脚本发送邮件。所以我安装了Wamp
并使用此link 设置sendmail.ini 和php.ini
当我运行我的 php 程序时,它会给出:
Email sending failed
我的php程序如下:
<?php
$to = 'xyz@gmail.com'; /* here i added email id of person which i want to send mail */
$subject = 'Testing sendmail.exe';
$message = 'Hi, you just received an email using sendmail!';
$headers = 'From: myid@gmail.com' . "\r\n" .
'Reply-To: myid@gmail.com' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers))
echo "Email sent";
else
echo "Email sending failed";
?>
所以我没有找到我错的地方。谁能帮我解决这个问题。
谢谢。
【问题讨论】: