2012-02-15 59 views
0

所以我此行中我的PHP的形式處理器:在PHP郵件的HTML鏈接?

$automessage = 'Thanks for requesting a sample from us! We have received your information, so please expect your sample shortly. In the meantime, be sure to connect with us on <a href="http://www.facebook.com/company">Facebook</a>!'; 

但鏈路仍顯示爲純文本,即使我有這個頭:

$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 

是我的鏈接的格式不正確的?

編輯:這裏是整個腳本:

<?php 


// CLIENT INFORMATION 

$firstname = $_POST['firstname']; 
$lastname = $_POST['lastname']; 
$email = $_POST['email']; 
$company = $_POST['company']; 
$address = $_POST['address']; 
$city = $_POST['city']; 
$state = $_POST['state']; 
$zip = $_POST['zip']; 
$phone = $_POST['phone']; 



// MODIFY THE FOLLOWING SECTION 

// your name 
$recipientname = "company"; 

// your email 
$recipientemail = "[email protected]"; 

// subject of the email sent to you 
$subject = "Sample Request for $recipientname"; 

// send an autoresponse to the user? 
$autoresponse = "yes"; 

// subject of autoresponse 
$autosubject = "Thank you for your sample request!"; 

// autoresponse message 
$automessage = 'Thanks for requesting a sample from company! We have received your information, so please expect your sample shortly. In the meantime, be sure to connect with us on <a href="http://www.facebook.com/company">Facebook</a> and Twitter!'; 

// thankyou displayed after the user clicks "submit" 
$thanks = "Thank you for contacting us. We will get back to you as soon as possible."; 

// END OF NECESSARY MODIFICATIONS 

// format message 
$message = "New sample request for $recipientname: 
<br> 
<br> 
First Name: $firstname 
<br> 
Last Name: $lastname 
<br> 
Email: $email 
<br> 
Company: $company 
<br> 
Address: $address 
<br> 
City: $city 
<br> 
State: $state 
<br> 
Zip: $zip 
<br> 
Phone: $phone 
<br> 
-- 
<br>"; 

// To send HTML mail, the Content-type header must be set 
$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 

// Additional headers 
$headers .= 'From: company <[email protected]>' . "\r\n"; 


// send mail and print success message 
mail($recipientemail, $subject, $message, $headers); 

if($autoresponse == "yes") { 
$autosubject = stripslashes($autosubject); 
$automessage = stripslashes($automessage); 
mail($email,"$autosubject","$automessage","From: $recipientname <$recipientemail>"); 
} 

header("Location: thank-you-sample.php"); 

?> 
+0

向我們展示了完整的電子郵件代碼 – 2012-02-15 22:12:15

+0

在查看電子郵件,你看到「​​」或只是「臉譜」 – 2012-02-15 22:13:40

+0

@benni_mac_b我看到的第一個一個「Facebok」 – miles 2012-02-15 22:16:47

回答

2
mail($email,"$autosubject","$automessage","From: $recipientname <$recipientemail>"); 
# You've forgotten to include the HTML-header here..^
+0

我不明白。我忘了什麼?您發佈的代碼看起來與我擁有的相同。 – miles 2012-02-16 15:46:18

+0

html郵件的標題在$標頭中設置。但是你不要在你的第二個郵件()中使用這些頭文件 - 調用。 – DragonWork 2012-02-16 16:28:58

+0

得到它的工作!謝謝! – miles 2012-02-16 17:27:34