【问题标题】:sendmail returned error code 8sendmail 返回错误代码 8
【发布时间】:2013-12-10 14:56:59
【问题描述】:

在由 Google Apps 处理邮件的 BlueHost 上运行的简单 PHP 脚本:

<?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 returned error code 8

【问题讨论】:

    标签: php email bluehost


    【解决方案1】:

    看来我需要做两件事:

    1. BlueHost 会检查 From: 地址是否在 cPanel 中——即使 Google Apps 处理了邮件。显然 cPanel 更新了 sendmail 的受信任用户列表。

    2. 如果To:地址在同一个主机上,它也必须存在于cPanel中,虽然我不知道为什么(sendmail优化?)。

    【讨论】:

      猜你喜欢
      • 2013-03-12
      • 1970-01-01
      • 2011-12-04
      • 2014-07-03
      • 1970-01-01
      • 2014-06-04
      • 2017-06-03
      • 2016-07-25
      • 1970-01-01
      相关资源
      最近更新 更多