我正在尝试在我的电子邮件中加入超链接,但它只显示为纯文本。我可能只是错过了 - 在$ BODY部分中使用我的引号而我只是没有看到它。
echo "Activation Code: " . $emailString . " <br>";
mysql_query("INSERT INTO accounts
(name, pass, email, activated, code) VALUES('$user', '$pass', '$email', 'false', '$emailString') ")
or die(mysql_error());
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$to = "$email";
$subject = "Hi!";
$body = '<html><head></head><body> Thank you for registering! Please go to this address to activate your account: <a href="'. $_SERVER['SERVER_NAME'] .'/PHP%20project/activate.php?activationCode='.$emailString.'">' .$emailString . '</a> </body></html>';
$from = "From:---@gmail.com";
if (mail($to, $subject, $body, $from, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
答案 0 :(得分:3)