doufu1950 2014-03-20 21:08
浏览 35

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

I think this is straightforward, but for some reason it's not working. Does anyone see a problem with my code? If not, I'm guessing it's the hosting that's the issue.

Here's the code:

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
" .
     "X-Mailer: php" . "Content-type: text/html; charset=iso-8859-1
";


//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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog