tags:

views:

61

answers:

2

Hi everyone, I'm trying to e-mail a html table, that has links within it. But when I receive the e-mail, it just shows me the html code itself.

I'm using PHP pear to send the email.

I try constructing a string like so

$body = "<table>";

$body = $body . "<tr><td><a href='http://google.ca'&gt;Google&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";

$body = $body . "</table>";

then e-mailing it, but when I receive the e-mail, it comes like this

<table><tr><td><a href='http://google.ca'&gt;Google&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

Any suggestions? Thanks!

+1  A: 

It doesn't look like you're setting the Content or MIME-type for HTML email (which means its just being sent in plain text).

Check out this link for a guide on HTML email in PHP: http://articles.sitepoint.com/article/advanced-email-php

ABach
short answer is to add this to your headers:"Content-Type: text/html"
Tjorriemorrie
+1  A: 

You'll want to ensure you are passing HTML to the setHTMLBody() function. If the problem continues, we'll need to see more of your PHP code.

webbiedave
You pointed me in the right direction, thank you!This article solved everythinghttp://www.phpmaniac.net/wiki/index.php/Pear_Mail
Idealflip
Glad I could help.
webbiedave