$to = $user_email;
$subject = "Test Notification\r\n";
$from = "Test Notification<noreply@test.com>";
$headers = "From: ".$from;
$headers .= "\r\nMIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail_content = "<html><body>";
$mail_content .= "<h4><strong>Hello ".$user_login.",</strong></h4>";
$mail_content .= "<div>". html_entity_decode($message)."</div>";
$mail_content .= "</body></html>";
mail($to,$subject,$mail_content,$headers);
您好,我有此代码发送电子邮件。
即时发送此示例电子邮件。
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eget blandit dui. Integer imperdiet malesuada sem a aliquet. Vivamus ut dui in erat mollis dapibus. Morbi rutrum turpis nec laoreet mattis. Maecenas in ligula augue. Proin aliquet nisl vitae aliquam sodales. Vestibulum blandit rutrum ligula sit amet ullamcorper. Aliquam eget nunc placerat, sagittis nibh ac, sagittis ligula. Curabitur et turpis ac dui consequat aliquet a vitae nibh. Etiam vitae nisl dui. Integer non tortor sit amet urna faucibus lobortis. Nulla tempus, metus et viverra ullamcorper, libero massa lacinia sapien, ut facilisis massa ipsum vel ligula. Quisque pretium arcu lectus, vel pretium diam convallis sit amet. Vestibulum tempor est sapien, at mattis nulla tincidunt et. Curabitur eu ipsum id tellus laoreet porttitor.
</p>
<a href="www.google.com">Visit my site</a>
当我查看我的电子邮件时,Visit my site
不是链接。
我该如何解决这个问题?虽然所有的html代码都已正确转换,但只有链接不是。
答案 0 :(得分:3)
您没有使用任何协议,您需要http://
或https://
,因此您的网址相对而不是绝对,所以它需要
<a href="http://www.google.com">Visit my site</a>
---^---
答案 1 :(得分:0)
试试这个,你需要添加http或https协议,否则它会将url视为本地资源
<a href="http://www.google.com" target="_blank">Visit my site</a>
....^
答案 2 :(得分:0)
您必须根据前面的网站添加http://
或ftp://
等协议,或者只是添加//
这样的
<a href="//www.google.com" target="_blank">Visit my site</a>