【发布时间】:2014-05-01 07:27:48
【问题描述】:
从我关于PHP Sent Email Contains HTML 的上一个问题继续,请帮忙提供建议,也许我的代码有误:
$from = "Someone <someone@example.com>";
$to = "Someone 1 <someone1@example.com>";
$subject = "Test Send Email";
$body = "<div>Test</div>";
$emaillist = "sample@example.com";
$host = "mail.example.com";
$username = "someone";
$password = "blabla";
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject,
'Content-Type' => 'text/html; charset=UTF-8',
'Bcc' => $emaillist
);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail))
{
echo("<p>" . $mail->getMessage() . "</p>");
}
else
{
echo("<p>Message successfully sent!</p>");
}
运行良好,但是当密件抄送无法运行时。我在另一封电子邮件中看到密件抄送,没有收到。
【问题讨论】:
标签: php