[PHP] Invio email in html
io ho gia creato un form per l'invio di email
solo che volevo mandare questa pagina in formato html ma quando la mando mi si vede il codice html e non la pagina
come faccio ad inviare la mail in html che si veda la pagina??
NB: il form funziona perchè le mail arrivano solo che si vede il codice html invece che la pagina
questo e il form contatti.html:
Codice PHP:
<form name="form1" method="post" action="mail.php">
<table width="95%" align="center" >
<tr>
<td colspan="2"><div align="center"><strong>MODULO INVITA AMICI</strong></div></td>
</tr>
<tr>
<td width="16%"><strong>Nome</strong></td>
<td width="84%"><input type="text" name="nome"></td>
</tr>
<tr>
<td><strong>Cognome</strong></td>
<td><input type="text" name="cognome"></td>
</tr>
<tr>
<td><strong>Città </strong></td>
<td><input type="text" name="citta"></td>
</tr>
<tr>
<td><strong>Indirizzo E-mail </strong></td>
<td><input type="text" name="mail"></td>
</tr>
<tr>
<td><strong>Oggetto</strong></td>
<td><input type="text" name="oggetto"></td>
</tr>
<tr>
<td><strong>Testo</strong></td>
<td><textarea name="testo" cols="40" rows="10" readonly="readonly"><table style="border: 0pt none ; text-align: left; width: 1001px; height: 489px;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td><img style="width: 300px; height: 110px;" alt="Zomer" src="http://zomer.altervista.org/loghi/logo.png"></td>
<td>Ciao $nome ti invita ad iscriverti a Zomer <a href="http://zomer.altervista.org">clicca qui per registrarti</a></td>
<td></td>
</tr>
<tr>
<td></td>
<td>
<h2 style="color: rgb(52, 134, 229);">Cos'è Zomer?</h2>
<p><span style="color: rgb(240, 30, 175);">Zomer è un
social network ma non solo, nato dall'idea di alcuni ragazzi come voi.
In Zomer puoi cercare vecchi amici, chattare con loro, iscriverti a
gruppi, condividere, creare un album fotografico e molto altro</span>
</p>
<span style="text-decoration: underline;"></span>
<table style="text-align: left; width: 419px; height: 128px;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td><img style="width: 50px; height: 50px;" alt="profilo" src="http://zomer.altervista.org/immagini/icone/profilo.png"></td>
<td><img style="width: 50px; height: 50px;" alt="amici" src="http://zomer.altervista.org/immagini/icone/amici.png"></td>
<td><img style="width: 50px; height: 50px;" alt="blog" src="http://zomer.altervista.org/immagini/icone/blog.png"></td>
<td><img style="width: 50px; height: 50px;" alt="album" src="http://zomer.altervista.org/immagini/icone/album.png"></td>
</tr>
<tr>
<td style="color: rgb(0, 128, 255);">Registrati e crea il tuo profilo!</td>
<td style="color: rgb(255, 0, 0);">Aggiungi i tuoi amici chatta, condividi foto,
divertiti!</td>
<td style="color: rgb(51, 204, 0);">Crea il tuo blog, modificalo, scrivi post, carica uno
sfondo, partecipa a concorsi!</td>
<td style="color: rgb(255, 102, 0);">Crea album fotografici carcando fino a 200 foto! </td>
</tr>
</tbody>
</table>
</td>
<td></td>
</tr>
</tbody>
</table>
<br>
<div style="text-align: center;"><small><small>Copyright Zomer 2010 - 2011</small></small></div></textarea></td>
</tr>
<tr>
<td width="16%"><strong>Indirizzi Amici</strong></td>
<td width="84%"><input type="text" name="to1"></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Invia">
</div></td>
</tr>
</table>
</form>
e questo e mail.php
Codice PHP:
<?php
$to = $_POST['to1'];
// IL SOGGETTO DELLA MAIL
$subject = "Invito per Zomer" ;
// COSTRUZIONE DEL CORPO DEL MESSAGGIO
$body = "Contenuto del modulo:\n\n";
$body .= "Dati personali ;<br>nome: " . trim(stripslashes($_POST["nome"])) . "\n";
$body .= "cognome: " . trim(stripslashes($_POST["cognome"])) . "\n";
$body .= "Città: " . trim(stripslashes($_POST["citta"])) . "\n";
$body .= "Oggetto: " . trim(stripslashes($_POST["oggetto"])) . "\n";
$body .= "testo: " . trim(stripslashes($_POST["testo"])) . "\n";
$body .= "mail: " . trim(stripslashes($_POST["mail"])) . "\n";
// INTESTAZIONI SUPPLEMENTARI
$headers = $_POST['mail'];
// INVIO DELLA MAIL
if(@mail($to, $subject, $body, $headers)) { // SE L'INOLTRO E' ANDATO A BUON FINE...
echo "La mail è stata inoltrata con successo.";
} else {// ALTRIMENTI...
echo "Si sono verificati dei problemi nell'invio della mail.";
}
?>