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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

including css file inside html email

Status
Not open for further replies.

captlid

Technical User
Oct 27, 2004
82
US
Is there anyway to include <style.css> so when the email is sent, the style parameters are invoked instead of outputting the code in plain text into the body of the email? (thats what happened when I tried file_get_contents(style.css) )

(I got it working by putting $css= "<style> ...</style>"; and inserting that into the message. But that would be messy for complex stylesheets)

Code:
<?php
if ($submit2) {
	$subject = "$title";
	$mailheaders = "From: $emailfrom\n";
	$mailheaders .= "Reply-to: $emailfrom\n";
	$mailheaders .= "Content-Type: text/html; charset=iso-8859-1\n";
    $fromEmail = "webmaster@domain.com";
    $filestring = file_get_contents("[URL unfurl="true"]http://$http_host$request_uri");[/URL]
    $webpage = stripslashes($filestring);

$msg = (
	 "Visit this Page   <a href=\"[URL unfurl="true"]http://www.domain.com$request_uri\">http://www.domain.com$request_uri</a>\n"[/URL]
			."$css\n"
			."$webpage\n"

	    );
		mail("$emailto", "$subject", "$msg", "$mailheaders", "-f $fromEmail");

	echo("<font color=\"red\">Webpage Sent.</font>");

	}

?>

help would be very appreciated.
 
The css file is referenced like any other web page. You could put one on a public web server and reference that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top