用了一个测试的例子,可以成功运行。。
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';  $headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();$s=mail($to, $subject, $message, $headers);
echo $s;

解决方案 »

  1.   

    先整理下格式<?php
      $name = $_POST[name];
      $mail = $_POST[mail];
      $subject = $_POST[subject];
      $message = $_POST[message];
     
    ?><!-- Mail -->
    <?php
    // check if all entries are write
      $empty ="";
      if (empty($name)) {
      $empty = $empty."<li> Ihr Name ist nicht ausgef&uuml;llt";
      }
      if(empty ($mail)) {
      $empty = $empty."<li>Ihre Mail-Adresse ist nicht ausgef&uuml;llt";
      }
      if (empty ($subject)) {
      $empty = $empty."<li>Betreffzeile ist nicht ausgef&uuml;llt";
      }
      if (empty  ($message)) {
      $empty = $empty."<li>Ihre Nachricht an uns ist leer";
      
      }
      if(!empty($empty)) {
        echo "Ihre Nachricht k&ouml;nnte nicht verschickt werden.<br>";
    echo "Bitte f&uuml;llen Sie folgende Angabefelder aus:<br><br>";
    echo "$empty <br><br>";
    echo "Bitte gehen Sie zur&uuml;ck zum Formular."; 
      }
      else {// Mailbasic//$text = $_POST[name]."\n".$_POST[mail]."\n".$_POST[subject]."\n".$_POST[message]."\n".$_POST[datum];
    //$s = mail("[email protected]", "Anfrage Shop", $text);
    //echo $s;   $CR = chr(13); //Zeilenwechsel
       $LF = chr(10); //Wagenruecklauf
       $Ret = $CR.$LF; 
       $Space = chr(32);
       $DRet = $Ret.$Ret;
       $breakpoint = chr(7); //Absatze
       $message = str_replace($DRet.$breakpoint.$message);
       $message = str_replace(Ret.$Space.$message);
       $breakpoint = explode($breakpoint.$message);
       $max = count($breakpoint);
       $Message = "";
       for ($i = 0; li <$max; $i++);
       $string = format($breakpoint[$i],55); //55 Zeichen, danach kommt ein Zeilenumbruch  
       $Message = $Message.$string.$DRed;
        function format ($string,$size) {
         GLOBAL $Ret;
         GLOBAL $Space;
         $Giveback ="";
    $fertig = fase;
    while (!$fertig) {
    //part 1
    $pos = $size;
    if (strlen($string)<=$pos) {
    $newline = trim ($string);
    $Giveback = $Giveback.$newline;
    $finish = true;
    }else{
    // part 2
    $out = false;
    while (!out) {
    // part 3
    $Zeichen = substr($string,$pos,1);
    $is_blank = ($Zeichen == $Space);
    if ($is_blank) {
    $newline = trim(substr($string, 0, $pos));
    $Giveback = $Giveback.$newline.$Ret;
    $string =substr($string,$pos);
    $out = true;
    } else {
    $pos--;
    }
    $a1="Absender;   $Name $Ret";
    $a2="E-Mail Adresse:  $Mail $Ret"; 
    $a3="date:  $date $Ret";
    $a4="time:  $time $Ret";
    $a5="subject: $subject $DRet";
    $Message = $a1.$a2.$a3.$a4.$a5.$Message;
    mail ($An, $subject, $Message);
    echo"<b> Vielen Dank, Ihre Nachricht vom <br>";
    echo "$date, $time Uhr wurde versandt.</b>";
    }
    }
    }
        return $Giveback;
        }
      }?>
    显示http500错误。
    The website cannot display the page 
     HTTP 500  
       Most likely causes:
    The website is under maintenance. 
    The website has a programming error. 
     
    想是上面的语句出了问题。小弟排查了几个小时,依然没有找到问题的根源。还劳烦哪位过路的大哥帮忙看看阿。。