php电子邮件问题,已成功发送但未收到任何内容

时间:2018-02-07 03:08:05

标签: php email post localhost

这是3天我有同样的问题,电子邮件已成功发送,但我没有看到任何消息,我在sendmail.ini中使用xampp localhost设置:

[sendmail]

smtp_server = smtp.gmail.com
smtp_port = 587
error_logfile = error.log
debug_logfile = debug.log
auth_username = xxx@gmail.com
auth_password = xxx
force_sender = xxx@gmail.com

在php.ini中,我改变了这个:

extension=php_openssl.dll

[mail function]

SMTP=smtp.gmail.com

smtp_port=587

sendmail_from = xxx@gmail.com

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

我做错了什么?,这是我的PHP代码:

<?php
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];

$to=$email;

$message="From:$name <br />".$message;

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

$headers .= 'From: ashry <xxx@gmail.com>'."\r\n" . 'Reply-To: '.$name.' <'.$email.'>'."\r\n";
$headers .= 'Cc: ashry.ramadhan17@gmail.com' . "\r\n";
@mail($to,$subject,$message);
if(@mail)
{
echo "Email sent successfully !!";    
}
?>

谢谢你的回复!。

0 个答案:

没有答案