繁体   English   中英

电子邮件中显示完整URL的链接,而不只是锚文本

[英]Link in email displaying full URL rather than just anchor text

如果满足某些条件,我将使用下面的代码发送电子邮件。 它运作良好。 但是, $link1显示为完整的URL,而不仅仅是锚文本。 我如何只显示锚文本?

提前致谢,

约翰

$querye = mysql_query("SELECT subcheck FROM submission WHERE subcheck = '1' AND submissionid = '$submissionid' ");

if (mysql_num_rows($querye) == 1)
{

$email_query = "SELECT email FROM login WHERE username = '$submittor'";
$result = mysql_query($email_query);
if (!$result) {
        trigger_error('Invalid query: ' . mysql_error()." in ".$email_query);
}

if($row = mysql_fetch_assoc($result)) {
        $mailaddress = $row['email'];


$link1 = "<a href='http://www.domain.com/path/comments/index.php?submission=".urlencode($submission)."&submissionid=".urlencode($submissionid)."&url=".urlencode($url)."&countcomments=".urlencode($countcomments)."&submittor=".urlencode($submittor)."&submissiondate=".urlencode($submissiondate)."&dispurl=".urlencode($dispurl)."'>Comment Link</a>";

    $message1 = "
Someone made the following comment on your submission $submission:

$comment


Please click the link below to see the comment in context.

$link1


";      


        $queryem = mail($mailaddress, "Someone has commented on your submission 
                        $submission.", $message1, "FROM: no-reply@domain.com");
}else{
        // no rows found.
}

}
else
{
//your subcheck is not 1 / nothing was found
}

您需要发送适当的标头以表明它是HTML电子邮件。

请参见手册中的示例4: http//php.net/manual/en/function.mail.php

您需要以HTML格式发送电子邮件,使用PHPmailer或mail()函数的标头将mime类型更改为html。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM