Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Fatal error: Cannot instantiate non-existent class: simplemail

[es] :: PHP :: Fatal error: Cannot instantiate non-existent class: simplemail

[ Pregleda: 2565 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

king_milutin
Beograd

Član broj: 80264
Poruke: 59



Profil

icon Fatal error: Cannot instantiate non-existent class: simplemail04.08.2006. u 17:30 - pre 214 meseci

Pomoc!!!

Koristim PHP 4.4.2, Apache 2.0.58 i MySQL 4.1.19.

Hocu da koristim klasu SimpleMail() ali mi izbacuje ovu gresku!!! U cemu moze biti problem?
Dok ima ovaca biće i džempera.
 
Odgovor na temu

SmilieBG
Aleksandar Skodric
NL

Član broj: 13094
Poruke: 1821
*.speed.planet.nl.



+3 Profil

icon Re: Fatal error: Cannot instantiate non-existent class: simplemail05.08.2006. u 01:45 - pre 214 meseci
moze biti da nemas tu klasu?! :)

jesi li je include-ovao?

Poz,
Sale
=========
Uporedi cene i karakteristike za vise od 10.000 proizvoda, izmedju ostalog:
Digitalni foto-aparati
Mobilni telefoni
Skolski pribor
=========
 
Odgovor na temu

king_milutin
Beograd

Član broj: 80264
Poruke: 59



Profil

icon Re: Fatal error: Cannot instantiate non-existent class: simplemail05.08.2006. u 16:09 - pre 214 meseci
Nije bila includovana :)

Ali onda nastaje novi problem. Nadjem ja lepo tu klasu i inludujem ali mi izbacuje gresku:

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in [ovde stoji adresa]\class.SimpleMail.php on line 4

class.SimpleMail.php glasi ovako:

------------------------------------------------------------------------------
Code:

<?php

class SimpleMail {
  public $to = NULL;
  public $cc = NULL;
  public $bcc = NULL;
  public $from = NULL;
  public $subject = '';
  public $body = '';
  public $htmlbody = '';
  public $send_text = TRUE;
  public $send_html = FALSE;
  private $message = '';
  private $headers = '';
  
  public function send($to = NULL, 
                       $subject = NULL, 
                       $message = NULL, 
                       $headers = NULL) {
    if (func_num_args() >= 3) {
      $this->to = $to;
      $this->subject = $subject;
      $this->message = $message;
      if ($headers) {
        $this->headers = $headers;
      }
      
    } else {
    
      if ($this->from) {
        $this->headers .= "From: " . $this->from . "\r\n";
      }
      if ($this->cc) {
        $this->headers .= "Cc: " . $this->cc . "\r\n";
      }
      if ($this->bcc) {
        $this->headers .= "Bcc: " . $this->bcc . "\r\n";
      }

      if ($this->send_text and !$this->send_html) {
        $this->message = $this->body;
      } elseif ($this->send_html and !$this->send_text) {
        $this->message = $this->htmlbody;
        $this->headers .= "MIME-Version: 1.0\r\n";
        $this->headers .= "Content-type: text/html; " .
                          "charset=iso-8859-1\r\n";
      } else {
        $_boundary = "==MP_Bound_xyccr948x==";

        $this->headers = "MIME-Version: 1.0\r\n";
        $this->headers .= "Content-type: multipart/alternative; " .
                          "boundary=\"$_boundary\"\r\n";
        
        $this->message = "This is a Multipart Message in " . 
                         "MIME format\n";
        $this->message .= "--$_boundary\n";
        $this->message .= "Content-Type: text/plain; " .
                          "charset=\"iso-8859-1\"\n";
        $this->message .= "Content-Transfer-Encoding: 7bit\n\n";
        $this->message .= $this->body . "\n";
        $this->message .= "--$_boundary\n";
        $this->message .= "Content-type: text/html; " . 
                          "charset=\"iso-8859-1\"\n";
        $this->message .= "Content-Transfer-Encoding: 7bit\n\n";
        $this->message .= $this->htmlbody . "\n";
        $this->message .= "--$_boundary--";     
      }
    }

    if (!mail($this->to,$this->subject,$this->message,$this->headers)) {
      throw new Exception('Sending mail failed.');
      return FALSE;
    } else {
      return TRUE;  
    }
  }

}

?>

------------------------------------------------------------------------------

Gde je problem?



//edit: (code) tagovi

[Ovu poruku je menjao boccio dana 07.08.2006. u 13:55 GMT+1]
Dok ima ovaca biće i džempera.
 
Odgovor na temu

The Sekula

Član broj: 53829
Poruke: 76
*.eunet.co.yu.

Sajt: www.sekulovic.net


Profil

icon Re: Fatal error: Cannot instantiate non-existent class: simplemail07.08.2006. u 08:23 - pre 214 meseci
Da bi koristio ovu verziju ove klase, moras imati PHP 5.
 
Odgovor na temu

king_milutin
Beograd

Član broj: 80264
Poruke: 59



Profil

icon Re: Fatal error: Cannot instantiate non-existent class: simplemail07.08.2006. u 13:14 - pre 214 meseci
Verovatno si u pravu posto sam preuzeo kod iz jedne knjige u kojoj se obradjuje PHP 5.

Hvala puno
Dok ima ovaca biće i džempera.
 
Odgovor na temu

The Sekula

Član broj: 53829
Poruke: 76
*.eunet.co.yu.

Sajt: www.sekulovic.net


Profil

icon Re: Fatal error: Cannot instantiate non-existent class: simplemail08.08.2006. u 07:39 - pre 214 meseci
Ovako napamet, na prvi pogled, ako

1.'public function' zamenis sa 'function'

2. sve ostale 'public' i 'private' zamenis sa 'var'

3. throw new Exception('Sending mail failed.');

zamenis sa:

trigger_error('Sending mail failed', E_USER_ERROR);


trebalo bi (naglasak na trebalo mozda sam nesto propustio) da radi i na php4.

 
Odgovor na temu

king_milutin
Beograd

Član broj: 80264
Poruke: 59



Profil

icon Re: Fatal error: Cannot instantiate non-existent class: simplemail31.08.2006. u 02:08 - pre 213 meseci
Jeste, bilo je do verzije PHPa. Hvala Sekula.
Dok ima ovaca biće i džempera.
 
Odgovor na temu

[es] :: PHP :: Fatal error: Cannot instantiate non-existent class: simplemail

[ Pregleda: 2565 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.