首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP PEAR电子邮件中的非静态方法错误

PHP PEAR电子邮件中的非静态方法错误
EN

Stack Overflow用户
提问于 2015-12-24 03:07:57
回答 1查看 2K关注 0票数 2

我试图使用PEAR从PHP应用程序发送电子邮件。电子邮件发送成功,但我得到了以下错误。这是正在使用的代码

代码语言:javascript
复制
include('Mail.php');
include('Mail/mime.php');
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "test@gmail.com";
$password = "123456";
$to = 'test1@gmail.com';
$from = "TEST <test@gmail.com>";
$replyto = "TEST <test@gmail.com>";
$subject = "TEST";
$name = TEST;

$headers = array('From' => $from, 'To' => $to, 'Subject' => $subject);
$smtp = Mail::factory('smtp', array('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
$html = "<html>
    <head></head>
    <body>
        <p>Dear " . $name . ",</p>
        <p>Test email</p>
    </body>

</html>";
$mime_params = array(
    'text_encoding' => '7bit',
    'text_charset' => 'UTF-8',
    'html_charset' => 'UTF-8',
    'head_charset' => 'UTF-8'
);

$crlf = "\n";
$mime = new Mail_mime($crlf);
//$body = $mime->get(array('text_charset' => 'utf-8'));
$mime->setHTMLBody($html);
//$mime->addAttachment($file, 'text/plain');
$body = $mime->get($mime_params);
$headers = $mime->headers($headers);
$mail = $smtp->send($to, $headers, $body);
$mail = $smtp->send($bcc, $headers, $body);
if (PEAR::isError($mail)) {
    echo("" . $mail->getMessage() . "");
}

错误信息

代码语言:javascript
复制
Strict Standards: Assigning the return value of new by reference is deprecated in /usr/share/php/Mail.php on line 154

Strict Standards: Non-static method Mail::factory() should not be called statically in /var/www/qcmc/registration2016/completed.php on line 252

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 225

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 339

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 344

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 347

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 390

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 394

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 236

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 494

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 637

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 641

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 649

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 653

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 657

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 662

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 528

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail.php on line 156

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 249

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 269

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 779

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 782

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method Mail_RFC822::parseAddressList() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail.php on line 221

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail.php on line 224

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 276

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 282

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 809

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 812

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 291

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 871

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 874

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 878

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 881

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 364

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 367

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 370

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 225

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 339

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 344

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 347

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 390

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 394

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 236

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 494

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 637

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 641

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 649

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 653

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 657

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 662

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 528

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail.php on line 156

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 249

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 269

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 779

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 782

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method Mail_RFC822::parseAddressList() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail.php on line 221

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail.php on line 224

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 276

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 282

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 809

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 812

Strict Standards: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 303

Strict Standards: Non-static method PEAR::getStaticProperty() should not be called statically, assuming $this from incompatible context in /usr/share/php/PEAR.php on line 871

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 1015

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 1018

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/smtp.php on line 286

Strict Standards: Non-static method PEAR::getStaticProperty() should not be called statically, assuming $this from incompatible context in /usr/share/php/PEAR.php on line 871

Strict Standards: Non-static method PEAR::isError() should not be called statically in /var/www/qcmc/registration2016/completed.php on line 287

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281
Failed to add recipient: @localhost [SMTP: Invalid response code received from server (code: 555, response: 5.5.2 Syntax error. c20sm50575655pfj.47 - gsmtp)]
Warning: Cannot modify header information - headers already sent by (output started at /usr/share/php/Mail.php:154) in /var/www/qcmc/registration2016/completed.php on line 294

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 364

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 196

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 367

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Net/SMTP.php on line 370

Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/share/php/PEAR.php on line 281
EN

回答 1

Stack Overflow用户

发布于 2016-05-18 07:01:29

  • 这些是警告,不是错误。
  • 这在梨1.10.1中是固定的。
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34446747

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档