Problem with sending mail with PEAR Mail.
[email protected] (Johan Salomonsson) Fri, 10 Apr 2015 23:11:40 +0200
| Newsgroups | php.pear.general |
|---|---|
| Message-ID | <[email protected]> |
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="[email protected]";
$to="[email protected]";
$subject="Hej!";
$body="Hi.\n\nHow are you?";
$host="smpt1.servage.net";
$port="25";
$username="[email protected]";
$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>");
}