John
John

Reputation: 4944

Link in email displaying full URL rather than just anchor text

I am using the code below to send out an email if certain conditions are met. It works fairly well. However, $link1 displays as a full URL rather than just as anchor text. How could I make just the anchor text display?

Thanks in advance,

John

$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: [email protected]");
}else{
        // no rows found.
}

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

Upvotes: 0

Views: 1634

Answers (2)

Sabeen Malik
Sabeen Malik

Reputation: 10880

You need to send the email as HTML, use PHPmailer or headers for the mail() function to change the mime type to html.

Upvotes: 1

Andrew67
Andrew67

Reputation: 357

You need to send appropriate headers that indicate it's an HTML email.

See Example #4 in manual: http://php.net/manual/en/function.mail.php

Upvotes: 1

Related Questions