i am using php mail
function
$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);
it is working fine, but this <a>
i am using is either not appended right or not written syntatically correct, the email i get is.
Hi this, You have been invited to join Maggie, you can do so by following
<a
href="http://google.com.pk" class="link"
id="position">this link</a>
, this is a sample email to send.
the tag is written as is, how can i append this <a>
into this mail?
答案 0 :(得分:2)
您需要指定标头。看一看。
$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";
使用&#34; (双引号)消息。
答案 1 :(得分:1)
将标题更改为或添加这些
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$header.= "X-Priority: 1\r\n";
答案 2 :(得分:1)
设置标题可能会有所帮助:
$headers = "Reply-To: FROM_NAME <FROM_EMAIL>\r\n";
$headers.= "From: FROM_NAME <FROM_EMAIL>\r\n";
$headers.='X-Mailer: PHP/' . phpversion();
$headers.= "X-Priority: 3\r\n";
$headers.= "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
答案 3 :(得分:1)
将其置于顶部:
header("Content-Type: text/html");
答案 4 :(得分:0)
标题应包含内容类型... $ header。=“Content-Type:text / html; charset = ISO-8859-1 \ r \ n”;