【发布时间】: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。
【问题讨论】: