PEAR::Mail Notice Strict Standards error

孤人 提交于 2019-12-14 03:17:56

问题


Installed PEAR Mail library and really like how it works, much better than PHP mail() function. However, I'm getting the strict standards notices showing up in the error_log with every mail sent. They're not fatal, but making a mess of the log.

Here is the controlling code:

$body = $_POST['message'];
 //using sendmail on backend
 $params['sendmail_path'] = '/usr/sbin/sendmail';

 //using factory method
 $mail_object =& Mail::factory('sendmail',$params);

 //loop through selected users to send
 for ($i=0;$i<count($recipients);$i++){
  if (!empty($recipients[$i]['email'])&&($recipients[$i]['alt_email'])){
    //concatinate email and alt_email
    $address = $recipients[$i]['email'].",".$recipients[$i]['alt_email'];
 }
 else {
    //only one user address
    $address = $recipients[$i]['email'];    
 }

//send the mail instance    
$mail_object->send($address,$headers,$body); 
if (PEAR::isError($mail_object)) {print($mail_object->getMessage());}
} //close the for loop

Then the error notice logged:

PHP Strict Standards: Non-static method Mail::factory() should not be called statically in emailSend.php on line 48, referer: etc.

PHP Strict Standards: Non-static method Mail_RFC822::parseAddressList() should not be called statically, assuming $this from incompatible context in /opt/local/lib/php/Mail.php on line 253, referer: etc.

PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in emailSend.php on line 65, referer: etc.

I could ignore these, but would rather fix the problem if anybody has some suggestion/experience with this. Been googling it, but everything is older.

PEAR 1.9.0
PHP 5.3.2

来源:https://stackoverflow.com/questions/12216742/pearmail-notice-strict-standards-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!