PHP 从 phpmailer 输出密件抄送对象值

PHP output bcc object values from phpmailer

我正在使用 phpmailer 并希望输出它发送到的密件抄送电子邮件地址以用于记录目的。 ($mail->AddBCC())

我可以用一个简单的 print_r($mail) 输出 $mail 对象...我只想输出:

print_r($mail->all_recipients:private);

但这不起作用。 我试过:

print_r($mail->{'all_recipients:private'});

但这也行不通。

print_r($mail);

显示:

[AltBody] => 
[WordWrap] => 0
[Mailer] => smtp
[Sendmail] => /usr/sbin/sendmail
[PluginDir] => 
[ConfirmReadingTo] => 
[Hostname] => 
[MessageID] => 
[Host] => smtp.gmail.com
[Port] => 587
...
[all_recipients:private] => Array
    (
        [exampl1@test.com] => 1
        [exampl2@test.com] => 1
        [exampl3@test.com] => 1
    )
...

只需调用 print_r($mail->getBccAddresses()); 即可获取 BCC 地址数组,如在 the source and the docs 中找到的那样。