I have this script:
require_once "Mail.php"; $from = "Stephen < username@nvrforget.com >";//Google apps domain $to = " username@gmail.com "; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "mail.nvrforget.com"; $username = " username@nvrforget.com "; $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>"); }
I come up with this error:
Non-static method Mail::factory() should not be called statically
Any idea how to fix this? Pear Mail is installed on the server.
source share