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

    PHP si mangia le lettere di una stringa!!!

    Allora,

    ho uno scriptino che manda una mailing list con html e allegati, solo che le email arrivano rovinate al destinatario poiché vedendo gli header e il body del messaggio ci sono parti nell'html e nel codice dell'allegato che sono mancanti:

    Esempi:

    Content-Transfer-Encoding: bae64

    invece di:

    Content-Transfer-Encoding: base64

    Che problema sarà???
    Il 90% dei problemi di un pc si trova
    tra la tastiera e la sedia.

  2. #2
    Utente di HTML.it L'avatar di _kime_
    Registrato dal
    Sep 2003
    Messaggi
    311
    mai visto
    + / Powered by Ubuntu 4.10 "The Warty Warthog"

    + / Manuale PHP.net

    + / Think Free

  3. #3
    questo accade solo quando uso il comando mail,
    altrimenti, se faccio un print di tutto l'header e il body del messaggio e creo un .eml, funziona tutto alla meraviglia...
    Il 90% dei problemi di un pc si trova
    tra la tastiera e la sedia.

  4. #4
    Utente bannato
    Registrato dal
    Apr 2003
    Messaggi
    1,119
    usi altre funzioni sul testo e sugli header? il testo normale arriva bene?

  5. #5
    Quando mando il modulo, le intestazioni ed il body vanno bene xké ho provato a metterle in un file .eml e outlook mi ha aperto tutto, anke l'allegato, cmq ecco la parte di codice:

    Codice PHP:
                        $mittente $_POST['nome']." <".$_POST['mittente'].">";
                        
    $oggetto "Messaggio dal sito Cral";
                        
    $messaggio stripslashes ($_POST['messaggio']);
                        
    $messaggio nl2br($messaggio);
                                            
    $body "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
    <HTML><HEAD>
    <META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">
    <META content=\"MSHTML 6.00.2800.1400\" name=GENERATOR></HEAD>
    <BODY bgColor=#ffffff>
    <STYLE type=text/css>
    <!--
    img {
        border: none;
    }
    .tah10 {
        font-family: Tahoma;
        font-size: 10px;
        text-decoration: none;
        color: #000000;
    }
    .tah11 {
        font-family: Tahoma;
        font-size: 11px;
        text-decoration: none;
        color: #000000;
    }
    .ver10 {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 10px;
        text-decoration: none;
        color: #000000;
    }
    .ver11 {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 11px;
        text-decoration: none;
        color: #000000;
    }
    .tah9 {
        font-family: Tahoma;
        font-size: 9px;
        text-decoration: none;
        color: #000000;
    }
    .ver9 {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 9px;
        text-decoration: none;
        color: #000000;
    }
    .Stile8 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; text-decoration: none; color: #FFFFFF; font-weight: bold; }
    .Stile11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; text-decoration: none; color: #000000; font-weight: bold; }
    -->
    </STYLE>

    <TABLE height=229 cellSpacing=0 cellPadding=0 width=563 border=0>
      <TBODY>
      <TR>
        <TD colSpan=3><IMG height=28 alt=\"\" 
          src=\"http://terzag.no-ip.com/cral/images_newsletter/border_up.jpg\" 
          width=563></TD></TR>
      <TR>
        <TD colSpan=3><IMG height=75 alt=\"\" 
          src=\"http://terzag.no-ip.com/cral/images_newsletter/bgitop.jpg\" 
        width=563></TD></TR>
      <TR>
        <TD rowSpan=2><IMG height=51 alt=\"\" 
          src=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_03.jpg\" 
          width=379></TD>
        <TD class=Stile8 width=83 
        background=http://terzag.no-ip.com/cral/images_newsletter/4-027_1_04.jpg 
        height=27>"
    .date("d/m/Y")."</TD>
        <TD rowSpan=2><IMG height=51 alt=\"\" 
          src=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_05.jpg\" 
          width=101></TD></TR>
      <TR>
        <TD><IMG height=24 alt=\"\" 
          src=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_06.jpg\" 
          width=83></TD></TR>
      <TR>
        <TD colSpan=3><IMG height=51 alt=\"\" 
          src=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_07.jpg\" 
          width=563></TD></TR>
      <TR 
    background=\"http://terzag.no-ip.com/cral/images_newsletter/4-027_1_08.jpg\">
        <TD class=ver10 
        background=http://terzag.no-ip.com/cral/images_newsletter/4-027_1_08.jpg 
        bgColor=#ea9901 colSpan=3>
          <TABLE cellSpacing=5 cellPadding=5 width=\"100%\" border=0>
            <TBODY>
            <TR>
              <TD>
                <P class=Stile11>"
    .$messaggio."</P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>";
                        
    $intestazioni "From: $mittente\n";//INTESTAZIONE COMUNE A ENTRAMBI I CASI
                        
    if ($allegato_error != 0) {//SE NON E' STATO INSERITO UN ALLEGATO
                        
    $intestazioni .= "Content-Type: text/html; charset=us-ascii\n";//INTESTAZIONI PARTE HTML
                        
    $msg_body $body;
                        } else { 
    //ALTRIMENTI
                        
    $boundary md5(uniqid(time()));//GENERO BOUNDARY
                        
    $attach $_FILES["allegato"]["tmp_name"];
                        
    $file_name $_FILES["allegato"]["name"];
                        
    $file_type $_FILES["allegato"]["type"];
                        
    $file_size $_FILES["allegato"]["size"];
                        
    $file = @fopen($attach"r"); //APRO L'ALLEGATO
                        
    $contents = @fread($file$file_size);//LO LEGGO
                        
    $encoded_attach chunk_split(base64_encode($contents));//LO DIVIDO E CODIFICO A 64BIT
                        
    @fclose($file);//INFINE LO CHIUDO
                        
    $intestazioni .= "MIME-version: 1.0\n"//INTESTAZIONI MULTIPART EMAIL
                        
    $intestazioni .= "Content-type: multipart/mixed; boundary=\"$boundary\"";
                        
    $intestazioni .= "X-attachments: $file_name\n";
                        
    $mail_body "--$boundary\n";
                        
    $mail_body .= "Content-Type: text/html; charset=us-ascii\n";//INTESTAZIONI PARTE HTML
                        
    $mail_body .= "Content-Transfer-Encoding: 7bit\n\n";
                        
    $mail_body .= "$body\n\n";
                        
    $mail_body .= "--$boundary\n";
                        
    $mail_body .= "Content-type: $file_type; name=\"$file_name\"\n"//INTESTAZIONI PARTE ALLEGATO
                        
    $mail_body .= "Content-Transfer-Encoding: base64\n\n";
                        
    $mail_body .= "$encoded_attach\n";
                        
    $mail_body .= "--$boundary--\n";
                        
    $msg_body $mail_body;
                        }
                        while (
    $row mysql_fetch_array($newsletter_sql)) { //PESCA DAL DATABASE TUTTE LE EMAIL
                        
    $destinatario $row['email'];
    mail($destinatario$oggetto$msg_body$intestazioni);//MANDA L'EMAIL
    }
                        print 
    "Il messaggio &egrave; stato recapitato presso tutti gli iscritti.</p>"
    Il 90% dei problemi di un pc si trova
    tra la tastiera e la sedia.

  6. #6
    up (ricordandovi che il comando mail è il problema [cioé ke si mangia i caratteri del body]) :quote:
    Il 90% dei problemi di un pc si trova
    tra la tastiera e la sedia.

  7. #7
    Utente bannato
    Registrato dal
    Apr 2003
    Messaggi
    1,119
    se provi a mettere un solo header cosa succede?

  8. #8
    ho provato a copiare l'intero codice da easyphp a un server di hosting gratuito e funziona benissimo, sarà qualche bug di PHP??? Ho EasyPHP 1.7 e non so come aggiornare solo il PHP, una mano?
    Il 90% dei problemi di un pc si trova
    tra la tastiera e la sedia.

  9. #9
    Utente bannato
    Registrato dal
    Apr 2003
    Messaggi
    1,119
    consiglio personale?
    scarica PHP, Apache e MySQL manualmente e installali da solo con l'aiuto di questa guida
    è meglio che usare pacchetti "precotti"

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.