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

    problemi con invio email (è windows?)

    ragazzi per mandare le mail utilizzo una libreria creata da me..
    Ecco il codice

    Codice PHP:
    class SmtpSender {
        
        var 
    $from;
        var 
    $to;
        var 
    $subject;
        var 
    $html;
        
        
    /**
         * Costruttore
         * @param $from mittente/mittenti dell'email
         * @param $to destinatario/destinatari dell'email
         */
        
    function SmtpSender($from$to) {
            if(
    is_array($from))    $this->from implode(" , ",$from);
            else 
    $this->from $from;
            if(
    is_array($to)) $this->to implode(" , ",$to);
            else 
    $this->to $to;
        }
            
        
    /**
         * Setta il subject dell'email
         * @param $subject subject
         */
        
    function setSubject($subject) {
            
    $this->subject $subject;
        }    
        
        
    /**
         * Setta il messaggio html dell'email
         */
        
    function setHtml($html) {
            
    $this->html $html;
        }

        
    /**
         * Invia l'email
         */
        
    function sendEmail() {
            
    $header  "MIME-Version: 1.0\r\n";
            
    $header .= "Content-type: text/html; charset=iso-8859-1\r\n";
            
    $header .= "To: ".$this->to."\r\n";
            
    $header .= "From: ".$this->from."\r\n";
            return 
    mail($this->to$this->subject$this->html$header);
        }


    Usandola online ha sempre funzionato a meraviglia...

    Da qualche giorno ho deciso di installare un server smtp sul mio serverino casalingo per fornire ai lavori in sviluppo un appoggio per fare test di invio di email.

    Ho installato Local SMTP Relay Server.

    Guardando nei log del programma l'email viene inviata correttamente, ma in realtà non arriva a nessuno degli eventuali destinatari. (nel php non ho nessun errore...)
    All'inizio pensavo che fosse un problema del programma, magari configurato male.

    Ho appena letto però, sul sito ufficiale del php, che la funzione mail può avere problemi di parsing quando eseguita da win...
    Può essere un errore di questo tipo o è soltanto il programma smtp che ha dei problemi??


    grazie :P
    www.gext.it

  2. #2
    ovviamente la classe viene utilizzata in questo modo

    Codice PHP:
    $sender "aaa.aaa@aaa.aa";
    $receipier= array("bbb.bbb@bbb.bb""ccc.ccc@ccc.cc");

    $smtp = new SmtpSender($sender,$receipier);
    $smtp->setSubject("Email dal sito");
    $smtp->setHtml("<html><head><title>title</title></head><body>prova</body></html>");
    $ok $smtp->sendEmail(); 
    www.gext.it

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.