问题
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