我正在尝试发送一封电子邮件(带有可点击链接),我可以收到该消息,但我无法点击链接,就像一个你无法点击它的文字!
我只用yahoo帐户才能解决这个问题我用gmail尝试它并且工作正常!
这是我的PHP代码:
$to = 'test@example.com';//$email;
// subject
$subject = 'subject';//'Activation account';
// message
$message = '<html>
<head>
<title>Activation account</title>
</head>
<body>
<p>Thank you for subscribing to our site, please click on the link below to activate your account:</p>
<a href="httm://www.google.com" style="font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif;display: inline-block;color: #FFFFFF;background-color: #8AC007;font-size: 15px;text-align: center;padding: 5px 16px;text-decoration: none;margin-left: 0;margin-top: 0px;margin-bottom: 5px;border: 1px solid #8AC007;white-space: nowrap;">
Activate my account
</a> /*styled link is not working*/
<br>
<a href="www.google.fr">google</a> /* even a simple link is not working*/
</body>
</html>';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
// Additional headers
$headers .= 'To: name <name@test.com>' . "\r\n";
$headers .= 'From: origin <contact@example.com>' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
答案 0 :(得分:0)
我刚刚解决了......似乎我必须用'http://'来写完整的链接我不知道为什么只有雅虎需要这种格式。它与gmail和hotmail一起工作正常。