Mail addCc VS mail addRecipient, OJS 2.3.1.2

Hi all, and thanks in advance,

I added a new row to my “book order confirm” code, basically I want to send this email template to multiple user, so I added the function “addCc” to my script, here is the code
$mail->setFrom($distributor->getBusinessEmail(), $distributor->getCompanyName());
$mail->addRecipient($distributor->getNotificationEmail(), $distributor->getCompanyName());
$mail->addCc($distributor->getDirectorEmail(), $distributor->getCompanyName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));

Unfortunately the email setup as $distributor->getDirectorEmail() has not received any email, so I wonder if addCc function has a different porpoise and I should use “addRecipient” instead, does “addRecipient” create a queue of emails or it send to only one recipient?

If “addRecipient” send email to multiple recipients I’ll modify the code in this way:
$mail->setFrom($distributor->getBusinessEmail(), $distributor->getCompanyName());
$mail->addRecipient($distributor->getNotificationEmail(), $distributor->getCompanyName());
$mail->addRecipient($distributor->getDirectorEmail(), $distributor->getCompanyName());
$mail->setSubject($mail->getSubject($journal->getPrimaryLocale()));
$mail->setBody($mail->getBody($journal->getPrimaryLocale()));

Hope this make sense

Thanks

Hi @marcello8080

Even you are dealing with your own customized code, your call do addCc should work as described, so perhaps the email is getting spam-trapped or interrupted during delivery.
I advise you verify your email server’s logs and check messages.

Regards,
Israel Cefrin
Public Knowledge Project Team

thanks @israel.cefrin

What I wanted to know is if “addRecipient” send out a email to multiple recipients or to a single recipient, in other words, what function should I use to send out email to multiple recipients?

Do you know what the folder to check email server’s logs in linux?

Thanks

Hi @marcello8080

Server’s log, in linux, are located in /var/log/ folder, Server’s log in linux are located in /var/log/ folder, mail log is specifically in /var/log/maillog file.

Regards,
Israel Cefrin
Public Knowledge Project Team