Forum Moderators: coopster

Message Too Old, No Replies

Send this page by email

         

stefansavva

11:43 pm on Sep 8, 2003 (gmt 0)

10+ Year Member



Ive been pulling my hair out on what should be a simple script and was hoping someone could have a quick look.

All Im trying to do is to email an individual HTML web page by clicking on a button within the page.

What have is;

$address = "some email";
$subject = "some subject";

$handle = fopen ("http://www.some_url.com", "rb");
$contents = "";
do {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$contents .= $data;
} while(true);
fclose ($handle);
mail($address, $subject, $contents);

But what happens is that the HTML comes through as a text email. Does anyone have any ideas?

Thanks,

san_garrafa

12:00 am on Sep 9, 2003 (gmt 0)

10+ Year Member



Simple solution:
change your code as this

mail($address, $subject, $contents,'Content-Type: text/html; charset=iso-8859-1');

More complex:
use the excellent mail class by Richard Heyes [phpguru.org]

San Garrafa

stefansavva

2:18 am on Sep 9, 2003 (gmt 0)

10+ Year Member



Works like a dream....many thanks.