how do I insert html (a href) into the contents of an email message

I have a function like this...

    require_once('Mail.php'); //---pear class
    $headers['From'] = $pFrom;
    $headers['To'] = $pTo;
    $headers['Subject'] = $pSubject;
    $params['host'] = '';

    $mail_object = & Mail::factory('smtp', $params);
    $mail_object->send($pTo, $headers, $pMessage);

I want to put a url in the message eg..

<a href='$setup->seStartingDirectory&report=$r&p=$p' target='_top'>
click here

but it displays it literally
All I want is..

click here

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

callrsConnect With a Mentor Commented:
Step 1:
In the value of $pMessage, be sure to enclose the entire message in opening <html>  and closing </html> tags

Step 2: Set the Content-type header
$headers['MIME-Version'] = '1.0';
$headers['Content-type'] = 'text/html; charset=iso-8859-1'

Hope it works. I based the above on Example 4 at
I think the mismatched < > pairs are causing the problem
<a .... > .... >

What if you replace the middle > with this: &#62;

Don't know much about email programs, but don't you have to set it to send as html and/or enclose the html part in <html>...</html> tags?
stevencopleyAuthor Commented:
I tried that but still shows all the html stuff.
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

How about moving the part


up on a separate line first, without knowing php something like


(if that is the syntax to set a var to something)

and then the url line something like:
<a href='$tmpvar&report=$r&p=$p' target='_top'>


You've got a couple of issues here. First of all, if you need php to parse some variables you'll need to use " not '. Also, to make it easier to read, i'd use {} around the variables i.e.

<a href="{$setup->seStartingDirectory}&report={$r}&p={$p}" target="_top">
click here

Hope this helps
Just looking at your previous code, the following syntax is probably more suited:

$pMessage = "<a href='{$setup->seStartingDirectory}&report={$r}&p={$p}' target='_top'>click here</a>";

stevencopleyAuthor Commented:
Sorry everyone the html I want to put in an email is this...

<a href='' target='_top'>
click here

please don't get bogged down on the syntax.

Again sorry my sample was both wrong and dumb.

I want to end up with a link that just says

click here (underscored as a link to

I dont want to see any html code.
in other words, I want to email a link to someone.
and I dont know how to do it.
stevencopleyAuthor Commented:
Thanks for sticking in there with me..
Thanks for the A. And funny thing is, I've never used Pear or PHP before :O

I'm just an avid learner haha
To thank gotta be nice to the environment that feeds my soul  ;)

Since you got it going, try this experiment:  Place the <html>..</html> tags only around PART of the message.
What happens to the rest of the sent message then:  Does the  non-enclosed part appear without HTML formatting, or with?
Fan example say the message is the text below. If received as text, spacing is retained. Received as HTML, 3 lines would turn into 1 line without any <BR> or <P> statements.. So what actually appears? Thanks.
-->Start of message
<html>html part of message <a href='' target='_top'>click here</a><html>
line one of text part
line two
line three
<--end of message
All Courses

From novice to tech pro — start learning today.