我正在使用 php mail
功能
$message.='Hi '.$name.', You have been invited to join this, you can do so by following <a href="https://www.google.com.pk/">This link</a>, '.$text.'';
$headers = "From: abc@gmail.com" . "\r\n" ."CC: abc@hotmail.com";
$emailTo = $email;
$subject = "Invitation email";
mail($emailTo, $subject, $message, $headers);
它工作正常,但是这个 <a>
我使用的要么没有附加正确,要么语法不正确,我收到的电子邮件是。
您好,您已受邀加入 Maggie,您可以通过以下方式加入
<a
href="http://google.com.pk" class="link"
id="position">this link</a>
,这是要发送的示例电子邮件。
标签是按原样写的,我怎么能附加这个<a>
进入这封邮件?
最佳答案
您需要指定 header 。看一看。
$message = "Hello, hope you are doing fine.<br>"
. "Please check this:<br>"
. "<a href=\"$url-here\">Anchor text</a>";
$headers = 'MIME-Version: 1.0' . "\r\n"
. 'Content-type: text/html; charset=iso-8859-1' . "\r\n"
. 'From: youremail@yourdomain.com' . "\r\n";
请使用 "(双引号)作为消息。
关于php - 在 php 中附加 html <a> 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34194933/