1
这里是我的代码:mail()函数没有不发送信息来源,以我的电子邮件
<?php
header('Content-type: text/plain; charset=utf-8');
$to = '[email protected]';
$subject = 'Message to the site';
$realname = htmlspecialchars($_POST['realname']);
$email = htmlspecialchars($_POST['email']);
$msg = htmlspecialchars($_POST['msg']);
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $msg, $headers) or die("Error!");
echo 'Thank you! :)';
?>
可能有人explaing我 - 为什么这个代码不能正常工作? 我的意思是,当我点击按钮提交时,它发送电子邮件,但我不能在其中包含$msg
,我不知道为什么。
你检查是否有味精变量的值? – 2014-09-26 09:01:39
尝试在msg变量中设置一些垃圾值。像$ msg =“你好”; – 2014-09-26 09:03:27
您是否收到“错误!”作为输出?或者你会得到“谢谢”而没有电子邮件? – Stony 2014-09-26 09:03:44