Visualizzazione dei risultati da 1 a 2 su 2

Discussione: fopen e variabili?????

  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    8

    fopen e variabili?????

    Ciao a tutti! ho un bel problemino...
    devo spedire mail via "cron" multiple con destinatari e oggetti diversi che ho già come risultati nei miei array ma quando utilizzo fopen per richiamare un php esterno le variabili non vengono processate. chissà se sono riuscito a spiegarmi bene
    In pratica avrei bisogno di inserire le mie variabili nella pagina aperta con fopen che utilizzerei come "template".
    sono a pezzi.

  2. #2
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    8

    più precisamente......

    provo ad essere più pratico. il file che viene richiamato da cron per spedire la mail è questo

    ////////////////////////////

    define("XMAILER",".................");
    define("FROM",".........................");

    class pippo
    {
    var $from = FROM;
    var $xmailer = XMAILER;
    var $boundary = "";
    var $headers = "";
    var $messaggio = ".................. ";
    var $correctView = "...........";
    var $cancIscr = ".......................";
    var $cancIscrtesto = "---------------";
    var $bcc = array();

    var $text = "testo.txt";
    var $html = "filephp.php";
    function pippo(){
    $this->boundary = "==String_Boundary_x" . md5(time()). "x";
    }

    function bcc($array){
    $this->bcc = $array();
    }

    function Send($to,$soggetto,$testo,$html){
    $this->_ReadText($testo);
    $this->_ReadHtml($html);
    $this->_BuildMail();
    return mail ($to, $soggetto, $this->messaggio, $this->headers);

    }

    function _BuildMail(){
    $this->headers = "From: " . $this->from . "\n";
    if(count($this->bcc) > 0){
    $temp = implode( ", ", $this->bcc);
    $this->headers .= "BCC: " . $temp . "\n";
    }
    $this->headers .= "X-Mailer: " . $this->xmailer . "\n";


    $this->headers .= "MIME-Version: 1.0\n";
    $this->headers .= "Content-Type: multipart/alternative;\n";
    $this->headers .= " boundary=\"" . $this->boundary . "\";\n\n";


    $this->messaggio = $this->text . "\n\n";
    $this->messaggio .= "--" . $this->boundary . "\n";
    $this->messaggio .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
    $this->messaggio .= "Content-Transfer-Encoding: 7bit\n\n";
    $this->messaggio .= $this->text;
    $this->messaggio .= "<\n>" . $this->cancIscrtesto. "\n\n";



    $this->messaggio .= "--" . $this->boundary . "\n";
    $this->messaggio .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
    $this->messaggio .= "Content-Transfer-Encoding: 7bit\n\n";

    if(!empty($this->correctView))
    $this->messaggio .= $this->correctView . $this->html . "\n";
    else
    $this->messaggio .= $this->html;
    $this->messaggio .= "
    " . $this->cancIscr. "\n";


    $this->messaggio .= "--" . $this->boundary . "--\n";
    }

    function _ReadText($filepath){
    $fo = fopen($filepath,"r");
    $this->text = fread($fo,filesize($filepath));
    fclose($fo);
    }

    function _ReadHtml($filepath){
    $fo = fopen($filepath,"r");
    $this->html = fread($fo,filesize($filepath));
    fclose($fo);
    }
    }


    $mail = new pippo();
    $mail->bcc = array("#","#");
    $mail->Send("dest","soggetto","testo.txt","filephp.php") ;

    //////////////////////////////////

    e nel file "filephp.php" ho il mio file php che contiene tutte le sue belle variabili e che richiama il suo template. Purtroppo però i dati non vengono processati!!!

    CHE FARE??
    helllllp!

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 © 2024 vBulletin Solutions, Inc. All rights reserved.