Take the 2-minute tour ×

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,


$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:


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



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

//your subcheck is not 1 / nothing was found
share|improve this question
This is a plain-text E-Mail, correct? –  Pekka 웃 Sep 15 '10 at 18:22
Not sure what that means. I guess it might be. I just want to send out text and a hyperlink or two. –  John Sep 15 '10 at 18:23
add comment

2 Answers

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

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer


