我试图使用以下方法发送邮件。但是如果我使用$headers
该功能不起作用。否则它工作正常。我哪里出错了?
if(isset($_REQUEST['submit']))
{
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$phone=$_REQUEST['phn'];
$country=$_REQUEST['country'];
$company=$_REQUEST['company'];
$subject=$_REQUEST['subject'];
$enquiry=$_REQUEST['message'];
$subject = "xyz.com-".$subject;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: ".$name."\r\n";
$headers .= "Reply-To: ".$email."\r\n";
$msg="
<table><tr><td>Name</td><td>".$name."</td></tr>
<tr><td>Email:</td><td>".$email."</td></tr>
<tr><td>Contact Number:</td><td>".$phone."</td></tr>
<tr><td>Country:</td><td>".$country."</td></tr>
<tr><td>Company:</td><td>".$company."</td></tr>
<tr><td>Message:</td><td>".$enquiry."</td></tr>
</table>";
if(mail("myName@gmail.com",$subject,$msg,$headers))
{
$msg1="Email Sent Successfully";
}
else
{
$msg1='Mail not sent. Please try again';
}
}