J'ai développé un petit script PHP qui permet d'envoyer un mail, avec un code HTML (et des variables PHP) via mon serveur mutualisé.
Je reçois parfaitement bien sur le webmail, mais outlook me déforme complétement mon tableau http://www.paradox.ma/visu.jpg. Mon code est le suivant :
Code : Tout sélectionner
<?php
session_start();
$logo= $_SESSION['logo'];
$message=$_SESSION['Message'];
$message_perso=$_SESSION['Message_Perso'];
$titre_message=$_SESSION['TxtTitreMsg'];
$signature=$_SESSION['LstSignatures'];
$destinataires=$_SESSION['LstEnvoi'];
$lg_max = 300; //nombre de caractère autoriser
if (strlen($message) > $lg_max)
{
$message = substr($message, 0, $lg_max);
$last_space = strrpos($message, " ");
$message = substr($message, 0, $last_space)."...";
}
$to = $destinataires; // email du destinataire
$sujet ='Votre carte de voeux'; //le sujet
$from ="From: xx@xx \n"; //votre email
$from .= "Mime-Version: 1.0\n";
$from .= "Content-Transfer-Encoding: 8bit\n";
$from .= "Content-Type: text/html; charset=\"utf-8\"\n";
$texte = '
<table id="Tableau_01" width="886" height="628" border="0" cellpadding="0" cellspacing="0" background="http://www.paradox.ma/ecards/template/images/background.jpg" >
<tr>
<td colspan="8">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_01.jpg" width="886" height="23" alt=""></td>
</tr>
<tr>
<td rowspan="5">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_02.jpg" width="13" height="604" alt=""></td>
<td colspan="3" width="611" height="108" valign="top">
<div id="titre" align="left"><h3>'.$titre_message.'</h3></div>
</td>
<td rowspan="2">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_04.jpg" width="9" height="198" alt=""></td>
<td rowspan="2" background="http://www.paradox.ma/ecards/template/images/theme1-1_05.jpg" valign="top"><img src="http://www.paradox.ma/ecards/logo/'.$logo.'" align="middle" alt=""> </td>
<td colspan="2" rowspan="2">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_06.jpg" width="33" height="198" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_07.jpg" width="611" height="90" alt=""></td>
</tr>
<tr>
<td rowspan="3">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_08.jpg" width="377" height="406" alt=""></td>
<td colspan="5" background="http://www.paradox.ma/ecards/template/images/theme1-1_09.jpg" width="480" height="343" valign="top"><div align="center">
'.$message. '
</div> </td>
<td rowspan="3">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_10.jpg" width="16" height="406" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_11.jpg" width="124" height="63" alt=""></td>
<td colspan="4" background="http://www.paradox.ma/ecards/template/images/theme1-1_12.jpg" width="356" height="57"><div align="right" ><font size="+2">'.$signature.'</font></div> </td>
</tr>
<tr>
<td colspan="4">
<img src="http://www.paradox.ma/ecards/template/images/theme1-1_13.jpg" width="356" height="6" alt=""></td>
</tr>
<tr>
<td>
<img src="http://www.paradox.ma/ecards/template/images/spacer.gif" width="13" height="1" alt=""></td>
<td>
<img src="http://www.paradox.ma/ecards/template/images/spacer.gif" width="377" height="1" alt=""></td>
<td>
<img src="http://www.paradox.ma/ecards/template/images/spacer.gif" width="124" height="1" alt=""></td>
<td>
<img src="http://www.paradox.ma/ecards/template/images/spacer.gif" width="110" height="1" alt=""></td>
<td>
<img src="http://www.paradox.ma/ecards/template/images/spacer.gif" width="9" height="1" alt=""></td>
<td>
<img src="http://www.paradox.ma/ecards/template/images/spacer.gif" width="220" height="1" alt=""></td>
<td>
<img src="http://www.paradox.ma/ecards/template/images/spacer.gif" width="17" height="1" alt=""></td>
<td>
<img src="http://www.paradox.ma/ecards/template/images/spacer.gif" width="16" height="1" alt=""></td>
</tr>
</table>
';
mail($to,$sujet,$texte,$from);
echo '<script language="Javascript">
<!--
document.location.replace("http://www.paradox.ma/ecards/index.php");
// -->
</script>';
?>
PS : J'ai modifié le charset, du coup, c'est bon pour les accents.
Merci à vous.