Problem with sending mail with PEAR Mail.
| From: | Johan Salomonsson | Date: | Fri, 10 Apr 2015 21:11:40 +0000 |
| Subject: | Problem with sending mail with PEAR Mail. | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-32014@lists.php.net to get a copy of this message | ||
I have problem with sending mail from my webpage using Mail in Pear. I get the error:
Strict standards: Non-static method PEAR::isError()
should not be called statically, assuming $this from incompatible
context in C:\wamp\bin\php\php5.5.12\Pear\pear\Mail\smtp.php on line 365
I have been searching all over on google but not got an answer. Do you know what it can depend on?
thanks in foreward!
/Johan Salomonsson
My code:
<?php
include("Mail.php");
$mail_settings['debug'] = FALSE;
$from="johan@salomonbeat.com";
$to="johan@salomonbeat.com";
$subject="Hej!";
$body="Hi.\n\nHow are you?";
$host="smpt1.servage.net";
$port="25";
$username="johan@salomonbeat.com";
$password="*******";
$headers=array('From' =>$from, 'To'=> $to, 'Subject'=>
$subject);
$smtp= @Mail::factory('smtp',array('host'=>$host,'port'=>
$port,
'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>");
}