我在我的網站上使用PHP郵件表單。我收到的郵件很好,但是我收到的郵件的格式爲[email protected]
,回覆地址也一樣。我如何更改我的代碼以在頭中獲取該人的姓名?我使用下面的代碼:PHP郵件表單 - 電子郵件標題
<?php
if(isset($_POST['submit'])) {
$to = '[email protected]' ; //put your email address on which you want to receive the information
$subject = 'Message - Contact Form Coast Med Spa'; //set the subject of email.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mailheader = "From: ".$_POST["FirstName"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$message = "<table>
<tr><td>Title</td><td>".$_POST['Title']."</td></tr>
<tr><td>First Name</td><td>".$_POST['FirstName']."</td></tr>
<tr><td>Last Name</td><td>".$_POST['LastName']."</td></tr>
<tr><td>E-Mail</td><td>".$_POST['Email']."</td></tr>
<tr><td>Phone Number</td><td>".$_POST['HomePhone']."</td></tr>
<tr><td>Comments</td><td>".$_POST['CAT_Custom_869']."</td></tr>
<tr><td>Contact Method</td><td>".$_POST['CAT_Custom_868']."</td></tr>
<tr><td>Subscribe to: eNewsletter</td> <td>".$_POST['CampaignList_41798']."</td></tr>
</table>" ;
mail($to, $subject, $message, $headers, $mailheader);
header('Location: http://coastlasercenter.com/html/message-contact.html');
echo "Your message has been received";
}
?>
你最好使用像'PHPmailer'這樣的郵件類。內建的mail()函數不適合當今的電子郵件標準,很難修改這些東西。 – Corubba 2012-03-11 12:59:41