我正在尝试在电子邮件正文中使用链接,但未能做到这一点,每当我发送电子邮件时,都会发送电子邮件,但它仅包含纯文本,但我也想打印链接,以便该链接将将我重定向到另一个页面。
这是我的php代码,
<?php
include("admin/config.php");
$email=$_POST['email'];
/// mail to customer
$to=$email;
$subject="Thanks for Contacting with us";
// Message
$message = '
<html>
<head>
<title>Request to Change Password</title>
</head>
<body>
<p>You have requested to change password <br> Please follow the below link to change your password.<br><br></p>
<p><a href="http://www.example.com/update-password.php">Change Password</a><br><br></p>
<p>Regards<br></p>
<p>http://www.example.com<br></p>
<p>9999999999<br></p>
</body>
</html>
';
$from = 'MIME-Version: 1.0' . "\r\n";
$from.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$from.= 'From: <no-reply@abc@gmail.com>' . "\r\n";
$mail =mail($to,$subject,$message,$from);
if ($mail == true){
header('location:forgot_password.php');
}
?>
请帮帮我,谢谢
答案 0 :(得分:1)
该链接未“显示”,因为您将其包装在<p>
标记中,该标记仅用于文本(段落)。将链接包装在<a>
标记中,并相应地设置href
属性:
<a href="your link">
A descriptive texte or your link again
</a>