php邮件中的html链接?

时间:2012-02-15 22:10:58

标签: php

所以我在我的php格式处理器中有这一行:

$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 = "me@company.com";

// 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 <me@company.com>' . "\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");

?>

1 个答案:

答案 0 :(得分:2)

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