Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read HTML page and send it as email

Status
Not open for further replies.

arlequin

Programmer
Sep 21, 1999
232
UY
Hello, developers.

I have this [1] html page which uses css and images and want to send it as email where the recipients must be online in order to download the css and images.

I use the following code to read the page and show it, before sending the email...

<?php
$file = '../archivo/infomens/html/2006-05.html';
// open file
$fh = fopen($file, 'r') or die('Could not open file!');
// read file contents
$message = fread($fh, filesize($file)) or die('Could not read file!');
// close file
fclose($fh);
// print file contents
echo $message;
?>

... but stylesheet and images won't load and the rendered page shows only text.

Strange behaviour, trying with another page [2] I have no problem loading it into a variable and sending it by email.



[1]<[2]<
Arlequín
arlequin_AT_montevideo_DOT_com_DOT_uy
 
To be honest, I'm suprised either works. You aren't specifying a content-type, and mail clients should treat your content as plain text by default.

You should be sending these pages as MIME email. And the best PHP library I know of for that is PHPMailer:


Want the best answers? Ask the best questions! TANSTAAFL!
 
Actually I am sending it using the correct content-type and using PHPMailer.

Anyway, thanks for the link.

The problem was the relative and absolute links.
In the 1st example I was using relative links to images and style sheets. That was why didn't work.

Arlequín
arlequin_AT_montevideo_DOT_com_DOT_uy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top