开发者

PHPMailer, CC and Linux server

开发者 https://www.devze.com 2022-12-28 22:40 出处:网络
how do I add a CC mail address in PHPMailer running on a Linux server? AddCC method only works on Windows: http://phpmailer.worxware.com/index.php?pg=methods

how do I add a CC mail address in PHPMailer running on a Linux server?

AddCC method only works on Windows: http://phpmailer.worxware.com/index.php?pg=methods

I tried with this method but the mail never arrives... I also tried with $mail->开发者_StackOverflow中文版addCustomHeader('CC: mymail@mail.com') without success.

Thank you.


I had problems with addCC with PHPMailer when there was already a recipient present. In order to fix this, the safemode of the mail function within PHPMailer had to be removed due to the shared server not allowing it. If you turn on errors you will find where the problem is coming from.

First answer here for reference. PHPmailer multiple recipients error


I have added some lines of code in my application. And I call it tricky things. You can add cc in your code as below :

if($ccList != "") { $ccRecipients = explode(",",$ccList); foreach($ccRecipients as $ccRecipient) { $mailer->AddCC($ccRecipient); //$mailer->AddAddress($ccRecipient); } $mailer->AddCustomHeader("Cc: $ccList"); }

You can change the code to meet your appication needs.

I hope it's working for you :)

Thanks.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号