【问题标题】:link is not showing in email body in php链接未显示在 php 的电子邮件正文中
【发布时间】:2019-07-05 23:09:27
【问题描述】:

我试图在我的电子邮件正文中使用一个链接,但没有这样做,每当我发送电子邮件时,电子邮件都会发送,但它只包含纯文本,但我也想打印一个链接,以便该链接将将我重定向到另一个页面。

这是我的 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');
}

?>

请帮帮我,提前谢谢

【问题讨论】:

    标签: email hyperlink


    【解决方案1】:

    该链接没有“显示”,因为您将它包装在一个仅用于文本(段落)的 &lt;p&gt; 标记中。将链接包装在 &lt;a&gt; 标记中并相应地设置 href 属性:

    <a href="your link">
        A descriptive texte or your link again
    </a>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-24
    相关资源
    最近更新 更多