2011-01-20 65 views
0

找到收件人的地址,而使用PHP郵件功能沒有在頭

的錯誤是發送郵件,我得到這個錯誤: - 沒有在標題中找到收件人地址

請幫我

這裏是代碼

//我的代碼從這裏

 $to = [email protected]; 
     $subject = $_POST['txtsub']; 
     $messgae = $_POST['txtmessage']; 
     $signature = $_POST['txtsignature']; 
     $redirect = "thanks.php"; 
     $error = "error.php"; 

      $body ="<table width='700' align='center' cellpadding='0' cellspacing='0' border='0'> 
       <tr> 
       <td valign='top'> 
         $messgae <br> 
       </td> 
       </tr> 
       <tr> 
       <td valign='top'> 
         $signature <br> 
       </td> 
       </tr> 
      </table>"; 

      $from  = "Aakrutisolutions<[email protected]>"; 
      $headers = "From: $from\n"; 
      $headers .= 'MIME-Version: 1.0' . "\r\n"; 
      $headers .= "Content-type: text/html;charset=iso-8859-1\r\n"; 
      $headers .= "Content-Transfer-Encoding: 8bit\r\n"; 
      $headers .= "X-Priority: 1\r\n"; 
      $headers .= "X-MSMail-Priority: High\r\n"; 
      $headers .= "X-Mailer: Just My Server\r\n"; 
      $headers .= "".$body."\n"; 

        if(mail($to, $subject, $message, $headers)) 
        { 
         ?> 
         <script language="javascript"> 
         location.href='bulkmail.php?sts=mailsent'; 
         </script> 
         <?php 
        } 
        else 
        { 
         ?> 
         <script language="javascript"> 
         location.href='bulkmail.php?sts=mailnotsent'; 
         </script> 
         <?php 

        } 

//中號開始而Y碼到此爲止

+0

告訴我們您正在使用 – 2011-01-20 06:33:42

+0

庵確切的PHP代碼...一些代碼,請我們可以幫你*有*的? – deceze 2011-01-20 06:33:47

+0

這是在PHP郵件常見的錯誤,我想每個人知道答案,只是OK等待分鐘我會複製過去的代碼,我的代碼是在一臺服務器的工作,但在godady服務器它給錯誤。 – Navruk 2011-01-20 06:37:35

回答

8

我能理解在評論嘲諷,從來沒有少,我不認爲它是好的,而那樣做的,即使答案是顯而易見的。這是很容易找到的信息:

$headers = 'From: Navruk <[email protected]>' . "\r\n" . 
      'To: Navruk1 <[email protected]>, Navruk2 <[email protected]>' . "\r\n" . 
      'Cc: Navruk3 <[email protected]>' . "\r\n" . 
      'Bcc: Navruk4 <[email protected]>' . "\r\n" . 
      'Reply-To: [email protected]' . "\r\n" . 
      'X-Mailer: PHP/' . phpversion(); 

mail(
     "[email protected]", 
     "How to do basic mailing", 
     "I can easily GOOGLE and find this LINK at the top http://php.net/manual/en/function.mail.php. Surprisingly, it is the PHP manual. If I CLICK this link I will find not only how to use the PHP command mail, but also a bunch of examples! This took me about 10 seconds to find.", 
     $headers 
    ); 

我建議你閱讀該消息並自己嘗試一下,你可以打我10秒?!?