Visualizzazione dei risultati da 1 a 10 su 22

Visualizzazione discussione

  1. #1

    Testo mail non visualizzabile su IOS

    Ciao a tutti ,

    vi chiedo aiuto per il seguente problema : ho un registro che , nel momento in cui viene compilato , invia una mail in formato html con i dettagli dell' evento registrato inseriti in una normale table . Tutto funziona correttamente fatta eccezione per il fatto che ,se si cerca di visualizzare la mail con un sistema IOS , la table appare completamente vuota , si vedono bordi e background ma non il testo , come se i campi non fossero compilati .

    Il codice che utilizzo per l'invio della mail è il seguente , in pratica verifica se è stata caricata una foto da allegare , altrimenti invia la mail così come definito in $dascrivere

    Grazie in anticipo !!!!!

    Codice PHP:

    $dascrivere 
    '<html>
                        <body>
           <style>
             table { background-color: #FFF7E3; color: #000000; border-color: #000000; font-size : 20 }
       </style>
      <table border="1" cellpadding="8">
      <tr>
        <th colspan="2" style="text-align : center ; font-size="xx-large">ISPEZIONE ID:   '
    .$idIsp.'</th>
      </tr>
     <tr>
        <th>DATA</th>
        <td>'
    .$dataOra.'</td>
      </tr>
      <tr>
        <th>OPERATORE</th>
        <td>'
    .$operatore.'</td>
      </tr>
      <tr>
        <th>OPERAZIONE</th>
        <td>'
    .$operazione.'</td>
      </tr>
      <tr>
        <th>RICHIEDENTE</th>
        <td>'
    .$richiedente.'</td>
      </tr>
      <tr>
        <th>ESITO</th>
        <td>'
    .$esito.'</td>
      </tr>
      <tr>
        <th>DESCRIZIONE</th>
        <td>'
    .$descrizione.'</td>
      </tr>
       <tr>
        <th>NOTE</th>
        <td>'
    .$note.'</td>
      </tr>
        <tr>
        <th>INOLTRO MAIL</th>
        <td>'
    .$destinatarimail.'</td>
      </tr>
    </table>

    </body>
    </html>'
    ;
    /////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                                                                                                                   
    // Recupero il valore dei campi del form

    $destinatario "mail@mail.it, $destinatarimail";
    $mittente "Registro Operazioni<scan.service@mail.it>";
    $oggetto "Inserita nuova Operazione";
    $messaggio =  '<html>
                        <body>
           <style>
             table { background-color: #FFF7E3; color: #000000; border-color: #000000; font-size : 20 }
       </style>
      <table border="1" cellpadding="8">
      <tr>
        <th colspan="2" style="text-align : center ; font-size="xx-large">OPERAZIONE  ID:   '
    .$idIsp.'</th>
      </tr>
     <tr>
        <th>DATA</th>
        <td>'
    .$data.'</td>
      </tr>
      <tr>
        <th>OPERATORE</th>
        <td>'
    .$operatore.'</td>
      </tr>
      <tr>
        <th>OPERAZIONE</th>
        <td>'
    .$operazione.'</td>
      </tr>
      <tr>
        <th>RICHIEDENTE</th>
        <td>'
    .$richiedente.'</td>
      </tr>
      <tr>
        <th>ESITO</th>
        <td>'
    .$esito.'</td>
      </tr>
      <tr>
        <th>DESCRIZIONE</th>
        <td>'
    .$descrizione.'</td>
      </tr>
       <tr>
        <th>NOTE</th>
        <td>'
    .$note.'</td>
      </tr>
      <tr>
        <th>FOTO</th>
        <td>'
    .$_FILES['foto']['name'].'</td>
      </tr>
    </table>
    </body>
    </html>'
    ;

    // Valorizzo le variabili relative all'allegato
    $allegato $_FILES['foto']['tmp_name'];
    $allegato_type $_FILES['foto']['type'];
    $allegato_name $_FILES['foto']['name'];

    // Creo altre due variabili ad uno interno
    $headers "From: " $mittente;
    $msg "";

    // Verifico se il file è stato caricato correttamente via HTTP
    // In caso affermativo proseguo nel lavoro...
    if (is_uploaded_file($allegato))
    {
      
    // Apro e leggo il file allegato
      
    $file fopen($allegato,'rb');
      
    $data fread($filefilesize($allegato));
      
    fclose($file);

      
    // Adatto il file al formato MIME base64 usando base64_encode
      
    $data chunk_split(base64_encode($data));

      
    // Genero il "separatore"
      // Serve per dividere, appunto, le varie parti del messaggio.
      // Nel nostro caso separerà la parte testuale dall'allegato
      
    $semi_rand md5(time());
      
    $mime_boundary "==Multipart_Boundary_x{$semi_rand}x";
     
      
    // Aggiungo le intestazioni necessarie per l'allegato
      
    $headers .= "\nMIME-Version: 1.0\n";
      
    $headers .= "Content-Type: multipart/mixed;\n";
      
    $headers .= " boundary=\"{$mime_boundary}\"";

      
    // Definisco il tipo di messaggio (MIME/multi-part)
      
    $msg .= "This is a multi-part message in MIME format.\n\n";

      
    // Metto il separatore
      
    $msg .= "--{$mime_boundary}\n";

      
    // Questa è la parte "testuale" del messaggio
      //$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
     
        
    $msg .= "Content-Type: text/html; charset=\"UTF-8\"\n";
        
    $msg .= "Content-Transfer-Encoding: 7bit\n\n";
      
    $msg .= $messaggio "\n\n";

      
    // Metto il separatore
      
    $msg .= "--{$mime_boundary}\n";

      
    // Aggiungo l'allegato al messaggio
      
    $msg .= "Content-Disposition: attachment; filename=\"{$allegato_name}\"\n";
      
    $msg .= "Content-Transfer-Encoding: base64\n\n";
      
    $msg .= $data "\n\n";

      
    // chiudo con il separatore
      
    $msg .= "--{$mime_boundary}--\n";
    }
    // se non è stato caricato alcun file
    // preparo un semplice messaggio testuale
    else
    {
     
    $msg $dascrivere;
      
    $headers "MIME-Version: 1.0\r\n";                                                                                                                                     //---//
    $headers .= "From: Registro Operazioni<scan.service@mail.com>\r\n";                                                             //---//
    $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n";                                                                                 //---//
    $headers .= "Content-Transfer-Encoding: 7bit\r\n";                                                                                                             //----//
                                                                         
    }

    // Invio la mail
    if (mail($destinatario$oggetto$msg$headers))
    {
      echo 
    "<p>Mail inviata con successo!</p>";
    }else{
      echo 
    "<p>Errore!</p>";

    ...
    Ultima modifica di Alex@1983; 25-09-2019 a 13:16

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.