Php sendmail返回错误代码8

Php sendmail返回错误代码8,php,email,bluehost,Php,Email,Bluehost,BlueHost上运行的简单PHP脚本,其中邮件由Google应用程序处理: <?php require_once('Mail.php'); $subject = 'Test Subject'; $message = 'Test Message'; $to = 'to@example.com'; // address on this domain $from = 'from@example.com'; // another address on the domain

BlueHost上运行的简单PHP脚本,其中邮件由Google应用程序处理:

<?php
  require_once('Mail.php');
  $subject = 'Test Subject';
  $message = 'Test Message';

  $to = 'to@example.com'; // address on this domain
  $from = 'from@example.com'; // another address on the domain
  $fromname = 'John Doe';

  $headers = array(
    'Return-Path' => $from,
    'From' => $from,
    'X-Priority' => '3',
    'X-Mailer' => 'PHP ' . phpversion(),
    'Reply-To' =>  "$fromname <$from>",
    'MIME-Version' => '1.0',
    'Content-Transfer-Encoding' => '8bit',
    'Content-Type' => 'text/plain; charset=UTF-8',
    'To' => $to,
    'Subject' => $subject
  );

  $params = '-i -v -f ' . $from;
  $sendmail = Mail::factory('sendmail', $params);
  $mail = $sendmail->send($to, $headers, $message);

  if (PEAR::isError($mail)) { $status = $mail->getMessage(); }
?>


$status
正在设置为
sendmail返回的错误代码8

看起来我需要做两件事:

  • BlueHost检查
    发件人:
    地址是否在cPanel中——即使Google应用程序处理邮件。显然,cPanel更新了
    sendmail
    的受信任用户列表

  • 如果
    To:
    地址在同一主机上,它也必须存在于cPanel中,尽管我不确定原因(
    sendmail
    optimization?)