2015-10-13 165 views
0

我正在使用PHPMailer从服务器发送电子邮件,它一直运行良好。我们最近将网站从Windows Server 2012移至Mac OS X 10.10。Mac OS X上的PHPMailer和CC地址

我遇到麻烦CC收件人现在的工作,它的Mac OS X上运行

我添加抄送收件人从一个数组:

foreach($ccRecipients as $ccRecipient) 
{ 
    $mail->AddCC($ccRecipient); 
} 

正在发送的电子邮件,但没有CC地址被包括在内 - 看起来它们以某种方式被转换成BCC地址,因为它们的电子邮件被传送到CC地址,但它们没有在CC地址部分列出。查看PHPMailer文档的AddCC功能,它提到“注意:该功能可以在win32上使用SMTP邮件程序,而不是”邮件“邮件程序。我收集这意味着它不会在OS X上工作?

如果那是真的,我有什么办法可以解决这个问题,并且仍然在OS X上包含使用PHPMailer的CC电子邮件地址?下面是发送电子邮件一些简单的代码:

require('inc/phpMailer/class.phpmailer.php');  
$mail = new PHPMailer(); 
$mail->IsSMTP(); 

$mail->AddAddress('[email protected]'); 
$mail->AddCC('[email protected]'); 

$emailSubject = 'Testing PHP Mailer'; 
$emailBody = 'Quick manual test of the PHP Mailer'; 

$mail->From = '[email protected]'; 
$mail->FromName = 'Acme Widgets'; 

$mail->IsHTML(true); 
$mail->Subject = $emailSubject; 
$mail->Body = $emailBody; 

if(!$mail->Send()) { 
$sendEmailError = 'There was an error sending the status email: '. $mail-  >ErrorInfo; 
echo $sendEmailError; 
} else { 
$sendEmailError = ''; 
} 
+0

添加完整的发送邮件代码 –

回答

0

它没有帮助,你根据你的过时的示例代码和使用的是旧版本的PHPMailer的。 Get the latest

就PHPMailer而言,OS X与Linux几乎完全相同,并且没有Windows的限制(为什么你会认为win32适用于OS X?),并且它默认包含postfix SMTP服务器。

对于使用CC地址的OS X没有特别的限制。如果您阅读文档,您会看到您可以设置$mail->SMTPDebug = 2;以查看SMTP对话。