0

ほんの数分前に参加しました。

連絡先ページからメールが送信されない理由を誰か教えてくれる人がいるかどうか知りたかった.

私のお問い合わせページはこちら

エラーは発生しません。情報を入力すると、送信されるようです。メールが送信されたというメッセージも表示されます。それなのにメールが来ない。

私が持っているDoctypeの上

formprocess.php は次のようにコーディングされています [スパムを避けるためにメールを取り出しました]:

    <?php
include('includes/corefuncs.php');
if (function_exists('nukeMagicQuotes')) {
  nukeMagicQuotes();
  }

// process the email
if (array_key_exists('send', $_POST)) {
  $to = 'info@domain.com'; // use your own email address
  $subject = 'Email from your contact form';

  // list expected fields
  $expected = array('name', 'email', 'comments');
  // set required fields
  $required = array('name', 'email', 'comments');
  // create empty array for any missing fields
  $missing = array();

  // assume that there is nothing suspect
  $suspect = false;
  // create a pattern to locate suspect phrases
  $pattern = '/Content-Type:|Bcc:|Cc:/i';

  // function to check for suspect phrases
  function isSuspect($val, $pattern, &$suspect) {
    // if the variable is an array, loop through each element
    // and pass it recursively back to the same function
    if (is_array($val)) {
      foreach ($val as $item) {
        isSuspect($item, $pattern, $suspect);
        }
      }
    else {
      // if one of the suspect phrases is found, set Boolean to true
      if (preg_match($pattern, $val)) {
        $suspect = true;
        }
      }
    }

  // check the $_POST array and any sub-arrays for suspect content
  isSuspect($_POST, $pattern, $suspect);

  if ($suspect) {
    $mailSent = false;
    unset($missing);
    }
  else {
    // process the $_POST variables
    foreach ($_POST as $key => $value) {
      // assign to temporary variable and strip whitespace if not an array
      $temp = is_array($value) ? $value : trim($value);
      // if empty and required, add to $missing array
      if (empty($temp) && in_array($key, $required)) {
        array_push($missing, $key);
        }
      // otherwise, assign to a variable of the same name as $key
      elseif (in_array($key, $expected)) {
        ${$key} = $temp;
        }
      }
    }

  // validate the email address
  if (!empty($email)) {
    // regex to ensure no illegal characters in email address 
    $checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
    // reject the email address if it doesn't match
    if (!preg_match($checkEmail, $email)) {
      array_push($missing, 'email');
      }
    }

  // go ahead only if not suspect and all required fields OK
  if (!$suspect && empty($missing)) {
    // build the message
    $message = "Name: $name\n\n";
    $message .= "Email: $email\n\n";
    $message .= "Comments: $comments";

    // limit line length to 70 characters
    $message = wordwrap($message, 70);

    // create additional headers
    /*$additionalHeaders = 'From: Frank Juval Studio Site';
    if (!empty($email)) {
      $additionalHeaders .= "\r\nReply-To: $email";
     }*/

    // send it  
    $mailSent = mail($to, $subject, $message, $additionalHeaders);
    if ($mailSent) {
      // $missing is no longer needed if the email is sent, so unset it
      unset($missing);
      }
    }
  }
?>

私は PHP プログラマーではありません。このコードは、チュートリアル付きで無料で提供しているサイトから入手しました。私の専門は HTML/CSS です。いよいよPHPに入ります。

事前に助けてくれてありがとう。

フランク

4

2 に答える 2

2

もっと単純なものを試してください:

mail('youremail@yourdomain.com', 'Subject', 'Message');

送信された場合は、スクリプトに問題がある可能性があります。そうでない場合は、ホストが電子メールの送信をサポートしていない可能性があります。

于 2010-01-10T04:30:41.097 に答える
-1
<?
 $destination="mailto:youremail@yourdomain.com";
$name=$_POST['Name'];
$Phone=$_POST['Phone'];
$State=$_POST['State'];
$email=$_POST['Email'];
$mes=$_POST['Message'];
$subject="Message from $name" ;
$mes="Name : $name\n Phone: $Phone\n
Email: $email\n\n Message: $mes\n";
mail($destination,$subject,$mes); 
?>
于 2010-10-02T22:27:49.903 に答える