编辑:这与可能的重复不同,因为他们从未收到过电子邮件。我的随机发送。
以下代码已经运行了近一年。然而,对于过去一周,它只在它想要的时候发送。我的家伙在多个设备上的多个位置使用它,同样的事情正在发生。
有一个html表单提交给这个PHP代码,然后通过电子邮件发送给我并显示一个html确认页面。他们正在收到确认页面,但我没有收到电子邮件。当天晚些时候,如果我回复,然后再次提交,我会收到电子邮件。
我无法理解。关于发生了什么的任何建议?我正在考虑制作一个它首先提交的SQL数据库,以便我可以查看他们输入的内容,但我没有收到电子邮件。
谢谢!
<?php
if(isset($_POST['submit'])) {
$to = "email_removed@gmail.com";
$subject = "Daily Inventory Submission";
// data the visitor provided
$location_field = filter_var($_POST['location'], FILTER_SANITIZE_STRING);
$yourname_field = filter_var($_POST['yourname'], FILTER_SANITIZE_STRING);
$biscuitsfull_field = filter_var($_POST['biscuits_full'], FILTER_SANITIZE_STRING);
$biscuitspartial_field = filter_var($_POST['biscuits_partial'], FILTER_SANITIZE_STRING);
$biscuitsemergency_field = filter_var($_POST['biscuits_emergency'], FILTER_SANITIZE_STRING);
$gravyfull_field = filter_var($_POST['gravy_full'], FILTER_SANITIZE_STRING);
$gravypartial_field = filter_var($_POST['gravy_partial'], FILTER_SANITIZE_STRING);
$eggsfull_field = filter_var($_POST['eggs_fullflats'], FILTER_SANITIZE_STRING);
$eggspartial_field = filter_var($_POST['eggs_partial'], FILTER_SANITIZE_STRING);
$cheese_field = filter_var($_POST['cheese'], FILTER_SANITIZE_STRING);
$sausagefull_field = filter_var($_POST['sausage_full'], FILTER_SANITIZE_STRING);
$sausagepartial_field = filter_var($_POST['sausage_partial'], FILTER_SANITIZE_STRING);
$jalapenos_field = filter_var($_POST['jalapenos'], FILTER_SANITIZE_STRING);
$sprayoil_field = filter_var($_POST['spray_oil_cans'], FILTER_SANITIZE_STRING);
$pouroil_field = filter_var($_POST['pour_oil'], FILTER_SANITIZE_STRING);
$tofu_field = filter_var($_POST['tofu'], FILTER_SANITIZE_STRING);
$almondmilk_field = filter_var($_POST['almond_milk'], FILTER_SANITIZE_STRING);
$veganbutter_field = filter_var($_POST['vegan_butter'], FILTER_SANITIZE_STRING);
$realbutter_field = filter_var($_POST['real_butter'], FILTER_SANITIZE_STRING);
$bacon_field = filter_var($_POST['bacon'], FILTER_SANITIZE_STRING);
$togo_field = filter_var($_POST['to_go'], FILTER_SANITIZE_STRING);
$hereboats_field = filter_var($_POST['here_boats'], FILTER_SANITIZE_STRING);
$flour_field = filter_var($_POST['flour'], FILTER_SANITIZE_STRING);
$potatoes_field = filter_var($_POST['potatoes'], FILTER_SANITIZE_STRING);
$waters_field = filter_var($_POST['waters'], FILTER_SANITIZE_STRING);
$oj_field = filter_var($_POST['orange_juice'], FILTER_SANITIZE_STRING);
$topo_field = filter_var($_POST['topo'], FILTER_SANITIZE_STRING);
$cokes_field = filter_var($_POST['cokes'], FILTER_SANITIZE_STRING);
$comment = filter_var($_POST['comment'], FILTER_SANITIZE_STRING);
//constructing the message
$body = "
Location: $location_field\n
Employee: $yourname_field\n\n
Biscuits_FULL: $biscuitsfull_field\n
Biscuits_Partial: $biscuitspartial_field\n
Biscuits_Emergency: $biscuitsemergency_field\n\n
Gravy_Full: $gravyfull_field\n
Gravy_Partial: $gravypartial_field\n\n
Eggs_Full: $eggsfull_field\n
Eggs_Partial: $eggspartial_field\n\n
Cheese: $cheese_field\n\n
Sausage_Full: $sausagefull_field\n
Sausage_Partial: $sausagepartial_field\n\n
Jalapenos: $jalapenos_field\n\n
Spray Oil Cans: $sprayoil_field\n
Pour Oil : $pouroil_field\n\n
Tofu: $tofu_field\n
Almond Milk: $almondmilk_field\n
Vegan Butter: $veganbutter_field\n\n
Real Butter: $realbutter_field\n\n
Bacon: $bacon_field\n\n
To Go Boxes: $togo_field\n
Here Boats: $hereboats_field\n\n
Flour: $flour_field\n
Potatoes: $potatoes_field\n\n
Waters: $waters_field\n
Daiya: $oj_field\n
Topos: $topo_field\n
Cokes: $cokes_field\n\n
Message:\n\n $comment";
mail($to, $subject, $body);
// redirect to confirmation
header('Location: confirmation.htm');
} else {
echo "Error, not sent";}
?>