我的PHP表单实际上并不是在发送邮件

时间:2018-05-28 23:47:31

标签: php email

我从示例表单中复制了这个并将其修改为我的目的。示例表单完美运行,因此我知道它不是服务器问题。此表单似乎已成功发送电子邮件,但我从未收到过。希望有人可以告诉我我错过了什么?

<?php

error_reporting(-1);
ini_set('display_errors', 'On');
set_error_handler("var_dump");

$email_to = "ddrapeau@gmail.com";
$email_subject = "Website Insurance Form";

// get posted data into local variables
$who_is = $_POST['who_is'];
$tinsurance = $_POST['tinsurance'];
$hcover = $_POST['hcover'];
$title = $_POST['title'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$smoke = $_POST['smoke'];
$partner_title = $_POST['partner_title'];
$partner_fname = $_POST['partner_fname'];
$partner_lname = $_POST['partner_lname'];
$partner_day = $_POST['partner_day'];
$partner_month = $_POST['partner_month'];
$partner_year = $_POST['partner_year'];
$hphone = $_POST['hphone'];
$ophone = $_POST['ophone'];
$email = $_POST['email'];
$street = $_POST['street'];
$postalcode = $_POST['postalcode'];

$validationOK=true;
if ($email=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=index.php/form-error\">";
  exit;
}


// prepare email body text

$email_message = "";
$email_message .= "YOUR REQUIREMENTS\n";

$email_message .= "Cover for: ";
$email_message .= $who_is."\n";

$email_message .= "Type of Coverage: ";
$email_message .= $tinsurance."\n";

$email_message .= "Amount of Coverage: ";
$email_message .= $hcover."\n";

$email_message .= "ABOUT YOU";

$email_message .= "Title: ";
$email_message .= $title."\n";

$email_message .= "Name: ";
$email_message .= $fname." ".$lname."\n";

$email_message .= "Date of birth DD MM YY: ";
$email_message .= $day." ".$month." ".$year."\n";

$email_message .= "Do you Smoke: ";
$email_message .= $smoke."\n";

$email_message .= "ABOUT YOUR PARTNER";

$email_message .= "Title: ";
$email_message .= $partner_title."\n";

$email_message .= "Name: ";
$email_message .= $partner_fname." ".$partner_lname."\n";

$email_message .= "Date of birth DD MM YY: ";
$email_message .= $partner_day." ".$partner_month." ".$partner_year."\n";

$email_message .= "CONTACT DETAILS\n";

$email_message .= "Home Phone: ";
$email_message .= $hphone."\n";

$email_message .= "Other Phone: ";
$email_message .= $ophone."\n";

$email_message .= "Email: ";
$email_message .= $email."\n";

$email_message .= "Address: ";
$email_message .= $street."\n";

$email_message .= "Postal Code: ";
$email_message .= $postalcode."\n";

// send email
$headers = 'From: '.$email."\r\n".
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $email_subject, $email_message, $headers);

?>

我已经尝试了所有我能想到的东西,但我认为没有理由不这样做。我三倍检查了顶部的电子邮件地址。错误报告不返回任何内容。

PHP版本是5.5

0 个答案:

没有答案