如何修复phpmailer中不工作的电子邮件链接

如何修复phpmailer中不工作的电子邮件链接,php,email,Php,Email,由于某些原因,链接在我的phpmailer中不起作用。电子邮件以按钮的形式发送。整个css都在工作,但链接不仅仅是工作 $mail->Body ='<!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title>Forgot Password?</title> </head> <body style="height: 40

由于某些原因,链接在我的phpmailer中不起作用。电子邮件以按钮的形式发送。整个css都在工作,但链接不仅仅是工作

$mail->Body ='<!DOCTYPE HTML>
<html lang="en">
<head>
  <meta charset="UTF-8">
<title>Forgot Password?</title>
</head>
<body style="height: 400px;width: 500px;display: block;float: left;text-decoration: none;background-color: white;position: relative;box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);top: 50%;left: 50%;margin-right: -50%;transform: translate(-50%, -50%);">
<div id="wrapper">
<p style="font-size: 20px;margin-left: 30px;">Change your password:</p>
<button style="font-family: &quot;Roboto&quot;, sans-serif;background: linear-gradient(to right, #5957CD, #B251C3);color: white;border: none;padding: 0.75em 1.75em;font-size: 16px;position: relative;text-decoration: none;outline: none;-webkit-appearance: none;-webkit-tap-highlight-color: transparent;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;border-radius: 5px;display: inline-block;float: right;margin-top: 40px;margin-right: 23%;"><a href="https://google.com" style="text-decoration: none;cursor: pointer;color: white;">Change Password</a></button>
</div>
</style>
</body>
</html>
';
$mail->Body=>
忘记密码了?
更改密码:

';
只需移除
周围的
只需移除
周围的
你赢了我:)

并将身体部分中的样式
position:relative
更改为
position:absolute


忘记密码了?
更改密码:

你赢了我:)

并将身体部分中的样式
position:relative
更改为
position:absolute


忘记密码了?
更改密码:

You best me to it:)根据W3C,“元素‘a’不能作为‘button’元素的后代出现。”@TechMaxed,在这种情况下,我建议您使用该工具检查html语法:You best me:)根据W3C,“元素‘a’不能作为‘button’元素的后代出现。”@TechMaxed,在这种情况下,我建议您使用该工具检查html语法: