0

我正在编写一个支持票证网站并需要电子邮件功能(PEAR),但我一直遇到这个问题:

下面的“No From: address has been provided”是脚本的一部分,显示了我认为问题出在哪里,请注意:敏感信息已被删除/编辑。

谢谢:

$replyto = "REDACTED";
$host = "REDACTED";
 $username = "REDACTED";
 $password = "REDACTED";
 $mime = '1.0';
 $content = 'text/html; charset=ISO-8859-1';
$subject = $subject;
$mime = "1.0";
$content = "text/html; charset=ISO-8859-1";
$headers = array ('From ' => $replyto,
'To ' => $to,
'Reply-To ' => $replyto,
'Mime-Version ' => $mime,
'Subject: ' => $subject,
'Content-Type' => $content);

$smtp = Mail::factory('smtp', array('host'=>$host,
'auth'=> true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to,$headers,$body);

if(PEAR::isError($mail)) {
    echo "ERROR: Could not send email: " . $mail->getMessage();
} else {
    $url = "http://support.myfallen.net/ticket.php?id=" . $internalId . "&successCode=1";
    header('Location:' . $url);
}
4

1 回答 1

2

' '由于某些奇怪的原因,您的 $params 数组中的所有键都以- 空格符号结尾。即,而不是...

array ('From ' => $replyto, ...

... 它应该是 ...

array ('From' => $replyto, ...

所有其他键都相同('To'而不是'To ''Reply-To'而不是'Reply-To ''Subject'for'Subject: '等)。

于 2013-06-09T09:50:49.407 回答