Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. danieledani
    3. Post
    D

    danieledani

    @danieledani

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 1
    • Post 2
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    Età 17
    0
    Reputazione
    2
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da danieledani

    • RE: Inviare mail con allegato un file txt presente sul sito

      Nessuno sa aiutarmi ????

      postato in Coding
      D
      danieledani
    • Inviare mail con allegato un file txt presente sul sito

      Grazie in anticipo

      In una cartella del mio sito è presente un file .txt
      Questo file deve essere inviato come allegato tramite mail.
      Ricevo correttamente la mail e l'allegato, ma purtroppo l'allegato è VUOTO...

      ecco il codice

      [php]<?
      $subject = "Copia file";
      $attach = "d:/inetpub/webs/sitocom/file/file.txt";
      $posta = "[email protected]";
      $to = "[email protected]";

      // INTESTAZIONI DELLA MAIL
      $headers .= "MIME-version: 1.0\n";
      $headers .= "Content-type: multipart/mixed; boundary="XX-1234DED00099A"\n";
      $headers .= "Content-Transfer-Encoding: 7bit\n";
      $headers .= "From: " .$posta;

      // Corpo del messaggio
      $messaggio = "--XX-1234DED00099A\n";
      $messaggio .= "Content-Type: text/plain; charset=iso-8859-1\n";
      $messaggio .= "Content-Transfer-Encoding: 7bit\n\r";
      $messaggio .= "\n Messaggio \n";
      $messaggio .= "--XX-1234DED00099A\n";
      $messaggio .= "Content-Type: application/octet-stream; name="$attach"\n";
      $messaggio .= "Content-Transfer-Encoding: base64\n";
      $messaggio .="Content-Disposition: attachment\n\r";

      $fp=@fopen($attach, "r");
      if ($fp) { $data = fread($fp, filesize($attach)); }
      $allega = base64_encode($data);

      $messaggio .= "$allega";
      $messaggio .= "--XX-1234DED00099A--\n";

      $sentOK = mail($to, $subject, $messaggio, $headers);
      if ($sentOK==1)
      {
      echo "invio OK, tutto regolare ";
      }
      else { echo "invio KO.."; }
      ?>[/php]

      Aiutatemi...

      Grazie

      postato in Coding
      D
      danieledani