Sendmail PHP无法正常工作 - Go Daddy Hosting

时间:2014-03-20 21:08:26

标签: php html5

我认为这很简单,但出于某种原因,它无法正常工作。有没有人看到我的代码有问题?如果没有,我猜这是托管问题。

以下是代码:

HTML

<form action="sendmail.php" name="form1" method="post">
       <input name="hidSubmit" type="hidden" value="true" id="hidSubmit" />
<input type="text" placeholder="Your Name" name="txtName" required><br>
<input type="email" placeholder="Email Address" name="txtEmail" required><br>
<input type="number" placeholder="Phone Number" name="txtPhone"><br>
<button type="submit" value="Submit" class="butt"><strong>Submit</strong></button>
    </form>

PHP

<?php

//Check whether the submission is made
if(isset($_POST["hidSubmit"])){

//msg body
$txtMsg = "Enquiry From Website
Name : ".$_POST["txtName"]."
Email: ".$_POST["txtEmail"]."
Phone: ".$_POST["txtPhone"]."
";

//Declarate the necessary variables
$mail_to = "info@insidemarketstrategy.com";
$mail_from= "admin@insidemarketstrategy.com";
$mail_sub="Inquiry from insidemarketstrategy.com Website";
$mail_mesg=$txtMsg; 
$headers = "From: admin@insidemarketstrategy.com\r\n" .
     "X-Mailer: php" . "Content-type: text/html; charset=iso-8859-1\r\n";


//Check for success/failure of delivery 
if(mail($mail_to,$mail_sub,$mail_mesg,$headers))
echo "<div class='alert alert-success alert-dismissable' id='alertmsg'>
 <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
 <h3>Thank you !<br><br><span>we will get in touch with you soon</span></h3>
</div>";
else
echo "<div class='alert alert-danger alert-dismissable'><center><span class='textred' align='center'><b>Failed to send the E-mail from $mail_sub to $mail_to</b></span></center></div>";
}

echo ("<meta http-equiv='refresh' content='5 ;url=index.html'>");
?>

0 个答案:

没有答案