以下是与发送邮件相关的PHP代码,此代码运行良好,但不显示链接。它就像一个普通的文字。还会在代码中显示中断标记。我认为错误在消息字符串中。我可以知道如何解决这个问题。
if(isset($_POST['submit'])){
$from = "#"; // sender
$to=$email;
$subject="Email verification";
$message='Hi, <br/> <br/> We need to make sure you are human. Please verify your email and get started using your Website account. <br/> <br/> <a href="'.$base_url.'activation/'.$activation.'">'.$base_url.'activation/'.$activation.'</a>';
$message = wordwrap($message,50);
mail($to,$subject,$message,"From: $from\n");
答案 0 :(得分:3)
您以纯文本形式发送电子邮件,而不是HTML格式。因此,HTML只是显示而不是呈现。
$from = "#"; // sender
$to = $email;
$subject = "Email verification";
$message = 'Hi, <br/> <br/> We need to make sure you are human. Please verify your email and get started using your Website account. <br/> <br/> <a href="'.$base_url.'activation/'.$activation.'">'.$base_url.'activation/'.$activation.'</a>';
$msg = wordwrap($message,50);
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to,$subject,$message,$headers);