Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    invio di e-mail contenenti html

    Riguardo all'invio di e-mail contenenti codice html, io ho usato per parecchio tempo due pagine che mi ero creato per inviare ad esempio delle immagini. Ora ho notato che in gmail non funzionano più (mentre per yahoo mail continuano a funzionare); vorrei sapere se qualcuno ne conosce il motivo dato che comunque ricevo messaggi provenienti da portali illustri che contengono foto e vengono visualizzati correttamente.
    Invio i codici relativi alle due pagine.
    codice:
    <html>
    <head>
    <title>Scrivi E-mail</title>
    </head>
    <body>
    <h3 style="margin-left:210px">Modulo di invio e-mail</h3>
    <form name="theform" method="post" action="invia_mail.php" target="_blanck">
    <table>
      <tr>
        <td>Destinatari:</td>
        <td><input type="text" name="to" size="80" value="<? echo $_POST["to"] ?>"></td>
      </tr>
      <tr>
        <td>Mittente:</td>
        <td>
          <input type="text" name="from" size="80" value="<? echo $_POST["from"] ?>">
        </td>
      </tr>
      <tr>
        <td>CC:</td>
        <td>
          <input type="text" name="cc" size="80" value="<? echo $_POST["cc"] ?>">
        </td>
      </tr>
      <tr>
       <td valign="top">BCC:</td>
       <td><textarea cols="60" rows="5" name="bcc"><? echo $_POST["bcc"] ?></textarea></td>
      </tr>
      <tr>
       <td>Oggetto:</td>
       <td><input type="text" name="subject" size="80" value="<? echo $_POST["subject"] ?>"></td>
      </tr>
      <tr>
      <td valign="top">Messaggio:
    [HTML]<center></td>
       <td>
         <textarea cols="60" rows="30" name="message"><? echo $_POST["message"] ?></textarea>
       </td>
      </tr>
      <tr>
       <td></td>
       <td>
        <input type="submit" name="submit" value="Vedi">
        <input type="reset" value="Cancella">
    	<input type="submit" name="submit" value="Invia">
       </td>
      </tr>
    </table>
    </form>
    </body>
    </html>
    codice:
    <?php
    $azione = $_POST["submit"];
    ?>
    <html>
    <head>
    <title><?php echo $azione; ?> E-mail</title>
    </head>
    <body>
    <?php
    $to = stripslashes($_POST["to"]);
    $cc = stripslashes($_POST["cc"]);
    $bcc = stripslashes($_POST["bcc"]);
    $from = stripslashes($_POST["from"]);
    $subject = stripslashes($_POST["subject"]);
    $message = stripslashes($_POST["message"]);
    $boundary = "==MP_Bound_xyccr948x==";
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Content-Transfer-Encoding: 7bit\r\n";
    if(isset($_POST["cc"])&&$_POST["cc"]!="") $headers .= "CC: " . $cc . "\r\n";
    if(isset($_POST["bcc"])&&$_POST["bcc"]!="") $headers .= "BCC: " . $bcc . "\r\n";
    $headers .= "From: " . $from . "\r\n";
    if ($azione=="Vedi") {
    	echo "<h3 style='margin-left:210px'>E-mail</h3>";
    	echo "Destinatario: $to
    ";
    	echo "Mittente: $from
    ";
    	echo "CC: $cc
    ";
    	echo "BCC: $bcc
    ";
    	echo "Oggetto: $subject
    ";
    	echo "Messaggio:
    ";
    	echo $message;
    }
    if ($azione=="Invia") {
    	$mailsent = mail($to, $subject, $message, $headers);
    	if ($mailsent) {
    	echo "<h3 style='margin-left:210px'>Report</h3>";
    	echo "<h3 style='color:red'>Il messaggio è stato inviato correttamente</h3>";
    	echo "Destinatario: $to
    ";
    	echo "Mittente: $from
    ";
    	echo "CC: $cc
    ";
    	echo "BCC: $bcc
    ";
    	echo "Oggetto: $subject
    ";
    	echo "Messaggio:
    ";
    	echo $message;
    } else {
    	echo "<h3 style='margin-left:210px'>Report:</h3>";
    	echo "<h3 style='color:red'>There was an error...</h3>";
    }
    }
    ?>
    </body>
    </html>

  2. #2

  3. #3
    Grazie, devo ancora leggerlo, spero non sia complicato. Se avessi dei dubbi posto il quella sezione.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.