ERRNO: 8192 when trying to send mail

我与影子孤独终老i 提交于 2019-12-11 18:35:32

问题


I have the following code which works when i put it in any blank php page,but when i try to put the code in another php page where i already have some codes in it, i get the error:

ERRNO: 8192
TEXT: Assigning the return value of new by reference is deprecated
LOCATION: C:\xampp\php\PEAR\Mail.php, line 154,
 include('Mail.php');
        $mail = Mail::factory("mail");

        $headers = array("From"=>"xyz@gmail.com", "Subject"=>"Your order has been placed   ");
        $body = "lol";
        $mail->send("abc@live.com", $headers, $body);

回答1:


You probably have an old version of PEAR::Mail. Could be version 1.1.14, the last stable version before the current stable version 1.2.0.

Try

pear channel-update pear.php.net
pear upgrade Mail

to get the latest version.


edit: This is not actually part of the answer but doesn't fit in a comment either:

For debugging purposes replace the factory function in pear/Mail.php by

function &factory($driver, $params = array())
{
  $driver = strtolower($driver);
  echo '<pre>Debug: driver=', $driver, "</pre>\n";
  echo '<pre>Debug: include_path=', get_include_path(), "</pre>\n";
  echo '<pre>Debug: cwd=', getcwd(), "</pre>\n";
  echo '<pre>Debug: __FILE__=', __FILE__, "</pre>\n";

  require_once 'Mail/' . $driver . '.php';
  $class = 'Mail_' . $driver;
  if (class_exists($class)) {
    $mailer = new $class($params);
    return $mailer;
  }
  else {
    throw new Exception('Unable to find class for driver ' . $driver);
  }
}


来源:https://stackoverflow.com/questions/2612684/errno-8192-when-trying-to-send-mail

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