Как исправить по электронной почте ссылку не работает в phpmailer - PullRequest
0 голосов
/ 18 ноября 2018

Почему-то не работает ссылка в моем 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>
';

Ответы [ 2 ]

0 голосов
/ 18 ноября 2018

Ты избил меня до этого :)

А также измените стиль position:relative на position:absolute в разделе тела

<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: absolute;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>
      <a href="https://google.com" style="text-decoration: none;cursor: pointer;color: white; 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%;">Change Password</a>
    </div>
  </body>
</html>
0 голосов
/ 18 ноября 2018

Просто удалите <button>, окружающий элемент <a>, и переместите форматирование <button> в элемент <a>, чтобы ваша ссылка выглядела как кнопка:

<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: absolute;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%;transform: translate(-50%, -50%);">
    <div id="wrapper">
      <p style="font-size: 20px;margin-left: 30px;">Change your password:</p>
      <a href="https://google.com" style="text-decoration: none;cursor: pointer;color: white; 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%;">Change Password</a>
    </div>
  </body>
</html>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...