PHP:PEAR邮件消息错误 [英] PHP: PEAR mail message error
问题描述
我可以通过这个代码(url:http://stackoverflow.com/questions/712392/send-email-using-gmail-smtp-server-from-php-page)发送电子邮件。
但错误显示如下...
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自/Users/abc/pear/share/pear/Mail/smtp.php第365行的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自第450行/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文>
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ /来自/ Users / abc / pear / share / pear / Net中的不兼容上下文/SMTP.php第467行
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自/ Users中的不兼容上下文/ ABC /梨/共享/梨/ N et / SMTP.php在第474行
严格标准:非静态方法PEAR :: isError()不应该静态调用,假设$ this来自于/用户/ abc / pear / share / pear / Net / SMTP.php在线517
严格标准:非静态方法PEAR :: isError()不应该被调用静态地假设$这是来自第265行的/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$这是来自不符合上下文的/Users/abc/pear/share/pear/Net/SMTP.php第521行
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自第376行的/Users/abc/pear/share/pear/Mail/smtp.php中的不兼容上下文p>
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自/ Users / abc / p中的不兼容上下文ear / share / pear / Net / SMTP.php在线628
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$这是来自/Users/abc/pear/share/pear/Net/SMTP.php第809行的不兼容上下文
严格标准:非静态方法PEAR :: isError ()不应该被静态调用,假设$这是来自第265行的/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应该被静态调用,假设$ this来自/ 8/13/13/6/28
$ b严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ /来自/ Users / abc / pear / share / pear / Net / SMTP中的不兼容上下文。 php on line 821
严格标准:非静态方法PEAR :: isError()不应该静态调用,假设$来自不兼容的上下文在/Users/abc/pear/share/pear/Net/SMTP.php第265行
严格标准:非静态方法PEAR :: isError()不应该被静态调用,假设$ this来自于/Users/abc/pear/share/pear/Net/SMTP.php第825行的不兼容上下文
严格标准:静态方法PEAR :: isError()不应该静态调用,假设$ this来自/services/abc/pear/share/pear/Net/SMTP.php第829行的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应该静态调用,假设这是来自第265行的/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ /来自/ Users / abc / pear / share / pear / net / SMTP.php on line 834
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ from第656行的/Users/abc/pear/share/pear/Net/SMTP.php中的无效上下文
严格标准:非静态方法PEAR :: isError()不应该静态地调用,假设$这是来自/ 249 /非静态方法PEAR :: isError()不应静态调用,假设$ this来自第285行/Users/abc/pear/share/pear/Mail/smtp.php中的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文第952行
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自/ Users / abc / pear / share / pear / Net / SMTP.php在线265
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$这与来自/Users/abc/pear/share/pear/Net/SMTP.php第955行的不兼容上下文
严格标准:非静态方法Mail_RFC822 :: parseAddressList()不应该静态调用,假设$ this来自第253行的/Users/abc/pear/share/pear/Mail.php中的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应该被静态调用,假设$ this来自/ 9 / b
严格标准:非静态方法PEAR :: isError()不应该被静态调用,假设$ this来自/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文在线265
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ /来自/ Users / abc / pear中的不兼容上下文/share/pear/Net/SMTP.php第985行
严格标准:非静态方法PEAR :: isError()不应为c在第1063行的/Users/abc/pear/share/pear/Net/SMTP.php中假设$ this来自不兼容的上下文$ / $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $方法PEAR :: isError()不应静态调用,假设$这是来自第265行/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自第1066行的/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文/ p>
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ /来自/ Users / abc / pear / share / pear中的不兼容上下文/Net/SMTP.php第1126行
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$来自不兼容的上下文/Users/abc/pear/share/pear/Net/SMTP.php第265行
严格标准:非静态方法PEAR :: isError ()不应该静态调用,假设$ this来自/Users/abc/pear/share/pear/Net/SMTP.php第1136行的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ this来自第1141行/Users/abc/pear/share/pear/Net/SMTP.php中的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$ /来自/ Users / abc / pear / share / pear / Net / SMTP中的不兼容上下文。 php在线491
严格标准:非静态方法PEAR :: isError()不应该静态调用,假设$ this来自/ Users / abc / Pear / share / pear / Net / SMTP.php在线265
严格标准:非静态方法PEAR :: isError()不应静态调用,假设$这与来自/Users/abc/pear/share/pear/Net/SMTP.php第494行的不兼容上下文
严格标准:非静态会议hod PEAR :: isError()不应静态调用,假设$ this来自/Users/abc/pear/share/pear/Net/SMTP.php第497行的不兼容上下文
严格标准:非静态方法PEAR :: isError()不应静态地在第27行的/Applications/MAMP/htdocs/p/testEmail.php中调用
邮件成功发送!
在php.ini文件中,我还将错误报告级别更改为
error_reporting = E_ALL ^ E_STRICT
有没有人可以帮我解决这个问题?
首先你要告诉PHP显示所有的错误和严格的标准违规。要忽略严格的标准(不是致命的),将错误报告级别更改为
// PHP.INI
error_reporting = E_ERROR ^ E_PARSE
//或更好,与error_reporting()
error_reporting(E_ERROR | E_PARSE)一致;
错误的根是PEAR的邮件类定义。我也在使用Mac Server和PEAR。这是多个电子邮件的更好的解决方案,但是会引发严格的标准错误。您可以忽略。
您可能在send()调用后有这行代码。
if(PEAR :: isError($ mail_object)){print($ mail_object-> getMessage());}
我更喜欢采取这一行,而是使用try / catch / exception。
我会更改错误报告级别对您的PHP.INI文件或内联(最佳选项)的错误报告修改之一。
I can send an email by the code in this (url:http://stackoverflow.com/questions/712392/send-email-using-gmail-smtp-server-from-php-page)
but the errors shown as following...
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Mail/smtp.php on line 365
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 450
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 467
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 474
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 517
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 521
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Mail/smtp.php on line 376
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 628
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 809
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 813
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 821
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 825
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 829
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 834
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 656
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Mail/smtp.php on line 249
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Mail/smtp.php on line 285
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 952
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 955
Strict Standards: Non-static method Mail_RFC822::parseAddressList() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Mail.php on line 253
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 982
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 985
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 1063
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 1066
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 1126
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 1136
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 1141
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 491
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 265
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 494
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /Users/abc/pear/share/pear/Net/SMTP.php on line 497
Strict Standards: Non-static method PEAR::isError() should not be called statically in /Applications/MAMP/htdocs/p/testEmail.php on line 27
Message successfully sent!
in php.ini file, I also change error reporting level to
"error_reporting = E_ALL ^ E_STRICT"
Could anyone help me to solve this problem?
First you're telling PHP to show all errors and strict standard infractions. To ignore the Strict Standards (which are non fatal) change your error reporting level to
// PHP.INI
error_reporting=E_ERROR^E_PARSE
//or better, inline with error_reporting()
error_reporting(E_ERROR | E_PARSE);
The root of the error is PEAR's Mail Class definition. I'm using a Mac Server also and PEAR. It is the better solution for multiple emails, however, it will raise Strict Standard errors. You can ignore.
You probably have this line of code after your send() call.
if (PEAR::isError($mail_object)) {print($mail_object->getMessage());}
I prefer taking this line out and instead using try/catch/exception instead.
I would change your error reporting level with one of the error reporting modifications to your PHP.INI file or inline (best option).
这篇关于PHP:PEAR邮件消息错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!