Question

Currently I have a script that send some mail, the script result are a couple html tables:

$from = "prueba.com <noreply@prueba.com>"; 
$to = "myemail@gmail.com"; 
echo "<div>"; 

$contenido = ob_get_contents(); 
echo "</div>"; 
$cabeceras = "Content-type: text/html; charset=iso-8859-1 \r\n" 
           ."MIME-Version: 1.0 \r\n" 
           ."To: $cliente <$email> \r\n" 
           ."From: prueba <prueba@example.com> \r\n"; 

mail($to,$subject,$contenido,$cabeceras); 

ob_end_flush(); 

As might give css to that email? as I have tried several methods and none has worked.

Thanks in advance for your cooperation

EDIT:

THIS is my CODE http://www.mediafire.com/?bq9352xh6paji1d

Was it helpful?

Solution

Maybe you wanted like this: (using ob_get_clean())

ob_start();
echo "<div>"; 
    // more html
echo "</div>";
$contenido = ob_get_clean(); 

and lose the last ob_end_flush();

TEST:

$from = "prueba.com <noreply@prueba.com>"; 
$to = "myemail@gmail.com"; 
ob_start();
echo "<div>"; 
echo "<table border='1'><tr><td>TEST</td></tr></tr>";
echo "</div>";
$contenido = ob_get_clean(); 

$cabeceras = "Content-type: text/html; charset=iso-8859-1 \r\n" 
           ."MIME-Version: 1.0 \r\n" 
           ."To: $cliente <$email> \r\n" 
           ."From: prueba <prueba@example.com> \r\n"; 

mail($to,$subject,$contenido,$cabeceras); 

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top