Was ist falsch mit diesem PHP-script senden Sie E-mail mit Pear Mail?

Habe ich dieses Skript:

require_once "Mail.php";

 $from = "Stephen <[email protected]>";//Google apps domain
 $to = "[email protected]";
 $subject = "Hi!";
 $body = "Hi,\n\nHow are you?";

 $host = "mail.nvrforget.com";
 $username = "[email protected]";
 $password = "password";

 $headers = array ('From' => $from,
   'To' => $to,
   'Subject' => $subject);
 $smtp = Mail::factory('smtp',
   array ('host' => $host,
     'auth' => true,
     'username' => $username,
     'password' => $password));

 $mail = $smtp->send($to, $headers, $body);

 if (PEAR::isError($mail)) {
   echo("<p>" . $mail->getMessage() . "</p>");
  } else {
   echo("<p>Message successfully sent!</p>");
  }

Ich komme mit diesem Fehler:

Non-static method Mail::factory() should not be called statically 

Irgendeine Idee, wie man dieses Problem beheben? Pear Mail auf dem server installiert ist.

  • Korrekt sieht. Sind Sie sicher, dass Ihr Pear-Mail-Bibliothek enthalten, richtig?
InformationsquelleAutor chromedude | 2011-08-18
Schreibe einen Kommentar