Generate html and email it

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
johniem
Forum Commoner
Posts: 29
Joined: Mon Jul 20, 2009 8:58 am

Generate html and email it

Post by johniem »

I want to send some newsletters and i have a script that generates the html page.

Code: Select all

 
ob_start();
    include_once $newsletter[0];//list of available news letters..here i get the first.
    $html = ob_get_contents();
ob_end_clean();  
 
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= 'From: <info@??????.com>' . "\r\n";   
 
the problem is that incoming email appears as html code in outlook and some simple css style is not working in web mail clients.
I'm using tables to style it.

I don't know if this is the correct way to send a generated script as email so any advices on that whould be appreciated.
Post Reply