下面是与发送邮件相关的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");
您发送的电子邮件是纯文本,而不是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);