doudeng3008 2015-06-18 13:02
浏览 39

接收来自网站的空白电子邮件

I am receiving blank emails from my website every day at 8:15am - 8:19am. They don't contain any information in them and do not contain the input id's either.

I have gone through multiple forums about this but I am new to PHP and seams to be a bit over my head.

    <?php 

function sendFormByEMail($msgBody) {
 $to = "email@gmail.com";
 $subject = "web visitor";
 $from = "email@gmail.com"; 

 $mailHdr = "";
 $mailHdr .= "From: ".$from."
";
 $mailHdr .= "Reply-To: ".$from."
";

 return mail($to, $subject, $msgBody, $mailHdr);
}


function getMessageText() {
 $msgTxt = "";
 $msgTxt .= "Sent: " . date("Y/m/d H:i:s") . "
";
 foreach ($_POST as $key => $value)
 {
   //$msgTxt .= urlencode($key) . "=" . urlencode($value) . "
";
   $msgTxt .= $key . " = " . $value . "
";
 }
 return $msgTxt;
}

if (sendFormByEMail(getMessageText())) {
  $nextPage = '../index2.html';
} else {
  $nextPage = '../index2.html';
}

header("Location: $nextPage");

?>

HTML

<form action="php/formsProcessor.php" method="post" enctype="multipart/form-data" name="quote" id="quote">
    <div class="row">
        <label for="name">Your name:</label><br />
        <input id="name" class="input" name="name" type="text" value="" size="30" /><br />
    </div>
    <div class="row">
        <label for="email">Your email:</label><br />
        <input id="email" class="input" name="email" type="text" value="" size="30" /><br />
    </div>
    <div class="row">
        <label for="message">Your message:</label><br />
        <textarea id="message" class="input" name="message" rows="7" cols="30"></textarea><br />
    </div>
    <input id="submit_button" type="submit" value="Send email" />
</form>

I have been trying to fix this for a few weeks now and any help would be GREATLY appreciated.

  • 写回答

1条回答 默认 最新

  • dongwei8729 2015-08-05 04:52
    关注

    Add this text to the header: "Content-type: text/html charset=iso-8859-1 "

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么