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

How to send content of HTML file in mail

Status
Not open for further replies.

moshemc

IS-IT--Management
Jan 24, 2009
5
IL
Hello all,

I'm trying to load a HTML file content, and then send it as the body of HTML email (as a newsletter). The mail is sent indeed , but I can't get the expected body. Please see my code and help.

Many thanks!

Code:
$host="myserver.secureserver.net";
$myFile = "[URL unfurl="true"]http://mywebsite.com/newsletter_site1.html";[/URL]
$fh = fopen($myFile, 'r');
$theData = fgets($fh);
fclose($fh);
//echo $theData;
	
mail("mosh@mywebsite.com", "TITLE!", "$theData", "From: my@gmail.com \nReply-To: my@gmail.com\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1");
 
That's right, and to send like html do the following...

$mail = new PHPMailer();
.....Configuring $mail
$mail->IsHTML(true); // send as HTML
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top