Envoi variable dans un e-mail html en PHP
je programme un site en php et j'envoie un mail pour l'inscription au format HTML. ma question est comment dans ce mail rajouter des données de ma base de données? (donc des données déjà récupérées) en variables PHP?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <?
// On initialise les variables
$destinataire = "personne@qui_recevra_le_mail.com";
$objet = "Voici une liste de sites à visiter." ;
$message = '
<html>
<head>
<title>Liste de site à visiter</title>
</head>
<body>
<table>
<tr>
<th width="59"><font color="#FF0000">Nom</font></th>
<th width="94"><font color="#FF0000">Adresse</font></th>
</tr>
<tr>
<td>Site de la commune de Felzins</td>
<td> <a href="http://www.felzins.fr" target="_blank">http://www.felzins.fr</a> </td>
</tr>
<tr>
<td>Site de la société BC Relocation</td>
<td>http://www.bcrelocation.fr</td>
</tr>
<br>
<h3>Donne moi ton avis. </h3>
</table>
</body>
</html>
'; |
Cela fonctionne mais comment rajouter par exemple dans mon code la variable $test = "toto" ???
J'ai essayé :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| <?
// On initialise les variables
$destinataire = "personne@qui_recevra_le_mail.com";
$objet = "Voici une liste de sites à visiter." ;
$message = '
<html>
<head>
<title>Liste de site à visiter</title>
</head>
<body>
<table>
<tr>
<th width="59"><font color="#FF0000">Nom</font></th>
<th width="94"><font color="#FF0000">Adresse</font></th>
</tr>
<tr>
<td>Site de la commune de Felzins</td>
<td> http://www.felzins.fr </td>
</tr>
<tr>
<td>Site de la société <? $toto ?>
</td>
<td>http://www.bcrelocation.fr</td>
</tr>
<br>
<h3>Donne moi ton avis. </h3>
</table>
</body>
</html>
'; |
mais cela ne fonctionne pas j'ai aussi essayé avec un <?php echo $toto $>
Si quelqu'un peu m'aider?