简单邮件脚本上的PHP错误

时间:2014-05-28 22:32:32

标签: php html email

请发送帮助我的编码非常糟糕,明天我必须将我的网站作为演示文稿展示(在7个小时内,现在是下午2点) 输入详细信息时,http://theomarkus.site90.net/contact.php会显示错误 http://puu.sh/95nto/931082b373.png 我已经完整地粘贴了有问题的php

    <?php
// Contact Form - http://coursesweb.net/php-mysql/
if(!isset($_SESSION)) session_start();        // starts session, if not already started
if(!headers_sent()) header('Content-type: text/html; charset=utf-8');            // sets header for UITF-8 encoding

/** HERE ADD YOUR DATA **/

$cmail['to'] = 'theomarkus@gmail.com';          // Receiver e-mail address (to which the email will be send)

// If you want to use the SMTP server from GMail, set the value 1 at GMAIL constant
// Add your GMail address at the GMAIL_USER, and add the password for this e-mail at GMAIL_PASS
// If you want to use the local mail server, let GMAIL to 0
define('GMAIL', 1);
define('GMAIL_USER', 'BLANKED');
define('GMAIL_PASS', 'BLANKED');

      /* From here no need to modify */

// Check the anti-spamm code
if(isset($_POST['anti_spam']) && isset($_POST['anti_spam1']) && $_POST['anti_spam']==$_POST['anti_spam1']) {
  // Check if all necessary data are received by post
  if(isset($_POST['nume']) && isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['message'])) {
    // removes external whitespace and tags
    $_POST = array_map("trim", $_POST);
    $_POST = array_map("strip_tags", $_POST);

    // gets form data
    $cmail['nume'] = $_POST['nume'];
    $cmail['from'] = $_POST['email'];
    $cmail['subject'] = $_POST['subject'];
    $cmail['body'] = 'E-mail from Contact form, sent by: '. $cmail['nume'] ."\n His /Her e-mail address: ". $cmail['from']. "\n IP: ". $_SERVER['REMOTE_ADDR']. "\n\n"
      .'message: '. $_POST['message']; 

    // include the class that sends the email
    include('sendmail/class.sendemail.php');

    // create an object of sendEMail class that sends the email
    $obEMail = new sendEMail($cmail);
    $re = $obEMail->re;
  }
  else $re = 'Error: not all form fields.';
}
else $re = 'Error: Incorrect verification code.';

echo $re;           // output the resulted message

2 个答案:

答案 0 :(得分:0)

看起来问题来自这里:

include('sendmail/class.sendemail.php');

你确定这是正确的道路吗?

答案 1 :(得分:0)

class.sendemail.php拼写错误,需要包含(&#39; sendmail / class.sendmail.php&#39;)或者class.sendmail / class.sendmail.php不在您的路径中。

如果不在您的道路上,最简单的方法可能是尝试以下方式:

include $_SERVER['DOCUMENT_ROOT'] . '/sendmail/class.sendmail.php';
相关问题