發送電子郵件我無法設置頁眉在PHP從地址我已經嘗試了所有可能的值:無法設置頭在PHP和的cPanel
下面的代碼是正確的,但代碼不附接到頭。
它顯示此爲默認值,但不會更改。
From : webhost:[email protected]
這是cpanel的問題嗎?
請幫助我,真的很感謝幫助。
在此先感謝。
<?php
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['contact'];
$subject = "feedback";
$question = $_REQUEST['question'];
$body = "<html>
<head>
</html>";
$mime_boundary = "<<<--==+X[".md5(time())."]\r\n\r\n";
$headers = "MIME-Version: 1.0"."\r\n" ."Content-Type:text/html;"."\r\n";
$headers .= 'From:'.$email. "\r\n";
$to ='[email protected]';
mail($to,$subject,$body,$headers);
echo "<script>alert(' message sent.');</script>";
?>
也試過:
<?php
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: Sender Name <[email protected]>";
$headers[] = "Reply-To: Recipient Name <[email protected]>";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();
mail($to, $subject, $email, implode("\r\n", $headers));
?>
只有這樣工作的:
$to ='[email protected]';
$subject="subject";
$body="body";
$mime_boundary = "<<<--==+X[".md5(time())."]\r\n\r\n";
$headers = "MIME-Version: 1.0"."\r\n" ."Content-Type:text/html;"."\r\n";
mail($to,$subject,$body,$headers);
爲什麼不嘗試發送簡單的郵件? – 2013-04-24 20:36:29
上面添加的代碼,如果標題有回覆,從那我可以迴應,因此用戶也可以不響應/迴應,因爲cPanel虛擬主機帳戶名稱將不會有一個電子郵件帳戶,因此交付將失敗。我想用我自己的ID替換標題這是所有! – 2013-04-24 20:43:52