我已阅读有关此问题的类似帖子,但无法完全理解我在这里做错了什么。收到“收件人”电子邮件正常。
但是,使用以下脚本时,我无法发送“抄送”电子邮件。任何帮助将非常感激。
// Require Pear Mail Packages
require_once ("Mail.php");
require_once ("Mail/mime.php");
require_once ("Mail/mail.php");
$crlf = "\n";
$from = "Company <admin@example.com>";
$to = $purchasersName . "<" . $purchasersEmail . ">";
$cc = "Company <admin@example.com>";
$subject = "Company Order Confirmation";
$host = "localhost";
$port = "25";
$username = "the username";
$password = "the password";
$hdrs = array ('From' => $from,
'To' => $to,
'Cc' => $cc,
'Subject' => $subject);
$mime = new Mail_mime(array('eol' => $crlf));
$mime->setHTMLBody($mailBody);
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$smtp =& Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $hdrs, $body);