Visualizzazione risultati 1 fino 3 di 3

Discussione: [PHP] Invio email in html

  1. #1
    Guest

    Predefinito [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&agrave; </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">&nbsp;</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.";

    }

    ?>

  2. #2
    Guest

    Predefinito

    Devi impostare le corrette intestazioni:

    Codice PHP:
    $header = "MIME-Version: 1.0\r\n";
    $header .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";
    $header .= "Content-Transfer-Encoding: 7bit\r\n";
    E poi nelle variabili che usi per l'invio dell'email ($body), puoi inserire del codice HTML

    Saluti!

  3. #3
    Guest

    Predefinito

    come faccio ad inserire questo codice nella variabile $body

    Codice PHP:
    <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>
    ma vorrei anche che le mail si potessero inviare a piu contatti
    Ultima modifica di sk1zzo : 11-09-2009 alle ore 11.57.53

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •