PHP联系表单正在提交但不发送在Parallel plesk panel 9.5上托管的电子邮件

时间:2013-05-31 04:56:56

标签: php plesk contact-form

我有一个PHP联系表单,我已经从以前的网站上交,所以我知道它的工作原理。当我将其上传到Parallel Plesk Panel 9.5上的托管站点时,表单提交但不会返回电子邮件。托管服务看了一下,没有生成任何日志。我上传了一个测试PHP表单,发送了一封电子邮件给我,所以想知道必须有一些东西在PHP。但正如我所说,它是一种已被使用过几次的表格,所以我无法弄清楚发生了什么。下面是php代码。

<?php



function isRequestSet($name) {
if (isset($_REQUEST[$name])) {
    return ( $_REQUEST[$name] != "" );
}
return false;
}

$firstname = "";
if (isRequestSet('firstname')) {
$name = $_REQUEST['firstname'];
 }
 $surname = "";
 if (isRequestSet('surname')) {
$name = $_REQUEST['surname'];
 }
 $number = "";
 if (isRequestSet('number')) {
  $number = $_REQUEST['number'];
  }
  $contact_number_type = array();
  if (isset($_REQUEST['contact_number_type'])) {
  $contact_number_type = $_REQUEST['contact_number_type'];
  }
  $email = "";
  if (isRequestSet('email')) {
$email = $_REQUEST['email'];
 }
 $postcode = "";
 if (isRequestSet('postcode')) {
$location = $_REQUEST['postcode'];
 }

$how_did_you_hear_about_us = array();
if (isset($_REQUEST['how_did_you_hear_about_us'])) {
 $how_did_you_hear_about_us = $_REQUEST['how_did_you_hear_about_us'];
 }

 $message = "";
  if (isRequestSet('message')) {
$location = $_REQUEST['message'];
  }
  $apartment_price_range = array();
  if (isset($_REQUEST['apartment_price_range'])) {
$apartment_price_range = $_REQUEST['apartment_price_range'];
 }

  $property_preference = array();
  if (isset($_REQUEST['property_preference'])) {
 $property_preference = $_REQUEST['property_preference'];
  }

 $url = "";
 if (isset($_REQUEST['url'])) {
   $url = $_REQUEST['url'];
  }

  $property = "";
   if (isset($_REQUEST['property'])) {
    $property = $_REQUEST['property'];
    }

    if (($name != "") && ($number != "") && ($email != "") && ($isspam != "yes")) {

    $to = 'name@company.com';
    $from = $email;
    $headers = 'From: ' . $from . "\n" ;
            'Reply-To: ' . $from . "\n";

    $vars = array('firstname', 'surname', 'contact_number_type', 'number', 'email', 'postcode', 'message','how_did_you_hear_about_us','apartment_price_range','property_preference');
    $message = "-----------\n";
    $message = "foxws id = $id\n";
    $message .= "-----------\n";
    foreach ($vars as $v) {
        $value = $_REQUEST[$v];
        $message .= "$v:\t$value\n";
    }

    $message .= "-----------\n";
    $message .= "\nSelect Contact Number Type:\n";
   foreach ($contact_number_type as $contact_number_type) {

        $message .= "$contact_number_type\n";
   }


    $message .= "-----------\n";
    $message .= "\nHow did you hear about Us?:\n";
    foreach ($how_did_you_hear_about_us as $how_did_you_hear_about_us) {

        $message .= "$how_did_you_hear_about_us\n";
    }

    $message .= "-----------\n";
    $message .= "\nApartment price range:\n";
    foreach ($apartment_price_range as $apartment_price_range) {

        $message .= "$apartment_price_range\n";
   }

    $message .= "-----------\n";
    $message .= "\nproperty_preference:\n";
    foreach ($property_preference as $property_preference) {

       $message .= "$property_preference\n";
   }

   $message .= "-----------\n";
    $message .= "$property\n";
    $message .= "$url\n";

    $subject = "Enquiry form submission";
    mail($to, $subject, $message, $headers, "-f $from");
    $confirm = true;
    //redirect to the 'thank you' page
    header("Location:thankyou.php");
  }
 ?>

0 个答案:

没有答案