[英]Not receiving mail sent by php even though I get “successfully submitted message”
我尝试通过html form \\ php代码发送电子邮件,当我检查电子邮件收件箱时,我收到了successfully submitted message
,即使我检查了垃圾邮件,我也没有收到任何消息? 这是我的PHP代码
<html>
<head>
<meta http-equiv="REFRESH" content="8;URL=form.html">
</head>
<body>
<div align="center">
<?php
$email = $_POST['email'];
$mailto = "xyz@gmail.com";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
$mailbody = "Email form the web site form:\n";
echo $_POST['email'];
while (list ($key, $val) = each ($_POST)) { $mailbody.= "$key : $val\n"; }
if (!eregi("\n",$_POST['email'])) {mail($mailto, $mailsubj, $mailbody, $mailhead);}
//print_r($HTTP_POST_VARS);
//header('Location:http://74.52.47.117/~irtech/irtech/');
?>
<span class="bodyw style1" >Thanks for enquiry we will contact you soon.</span>
</div>
</body>
</html>
根据您使用的电子邮件客户端/程序,您需要在电子邮件正文中添加doctype和html标签,并在标题中声明Content-type。
尝试如下更改$mailbody
和$mailhead
:
$mailbody = '<!DOCTYPE HTML>
<html><body>
<p>Email form the web site form:</p>
</body></html>';
$mailhead = "From: $email\n";
$mailhead .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
还值得注意的是,如果要发送html邮件,则只需使用<p>
和<br>
,它就不会识别\\n
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.