我在发送邮件时遇到一些问题,我的邮件没有发送给收件人..但是给我发回电子邮件。我的代码在这里请建议我
<?php
if(isset($_POST["c_submit"]))
{
if(($_POST['captcha']!="") || ($_SESSION['captcha_id'])!="")
{
if($_POST['captcha']==$_SESSION['captcha_id']) {
$to_customer = $_POST["mail"];
$subject = "Thanking you for Contacting US";
$mail_body = "
<html>
<head>
<title>Thanking you for Contacting</title>
</head>
<body>
<font face='Verdana'>
Dear ".$_POST["name"].",</br>
<p>Thank you for visiting our website. We have received your enquiry through our web form. We appreciate you considering</p>
<p>Sincerely,</p>
<b>Penis Plug. Ltd.</b><br />
Website:". $site."<br />
Email:" .$email."<br />
<br />
<br />
</font>
</body>
</html>";
$to = "ashish.sws@gmail.com";
$mail_subject = "Contact Form Mail";
$to_mail_body = "
<htm>
<head>
<title>Customer Details</title>
</head>
<body>
<font face='Verdana'>
<table>
<tr>
<th>Name : </th>
<td>".$_POST["name"]."</td>
</tr>
<tr>
<tr>
<th>Message : </th>
<td>".$_POST["message"]."</td>
</tr>
<tr>
<th>Email </th>
<td>".$_POST["email"]."</td>
</tr>
<tr>
<th>Contact No. : </th>
<td>".$_POST["phone"]."</td>
</tr>
<tr>
<th>Company : </th>
<td>".$_POST["company"]."</td>
</tr>
</table>
</font>
</body>
</html>
";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.'http://www.swatiwebtechnologies.com'.'<'.'ashish.sws@gmail.com'.'> ' . "\r\n";
if(@mail($to_customer,$subject,$mail_body,$headers))
{
echo "Mail send completed.";
}
else
{
echo "Cannot send mail.";
}
@mail($to,$mail_subject,$to_mail_body,$headers);
} else if($_POST['captcha']!=""){
echo '<font color="red"><b>Not Matching, Try Again...</b></font>';
}
}
}
?>
在这里,我发送两封邮件给客户,一封自助邮件问题出现,自助邮件工作正常......请建议我
答案 0 :(得分:1)
根据docs,函数在发送失败时返回false
。
$flgSend = @mail(...);
如果这导致您的代码显示&#34;邮件发送已完成。&#34;,但它仍然没有出现在您的收件箱中,那么要么它还没有到达,要么就是垃圾邮件过滤器抓住了它。
答案 1 :(得分:0)
尝试检查电子邮件发送
if(@mail($to_customer,$subject,$mail_body,$headers))
{
echo "Mail send completed.";
}
else
{
echo "Cannot send mail.";
}
答案 2 :(得分:0)
建议:
http://www.com
部分中的from:
是否有效?