Error Recurring Invoices could not be sent

On first of the month, recurring invoices are emailed to customers. For some reason only few of the customers gets the emails, the rest the invoices are created as drafts, any idea how to figure it out?

ERROR - 2021-01-01 00:00:29 → [Recurring Invoices] Invoice 1628could not be sent. Please review your Email settings.

This “log” actually tells nothing really valuable. But if you can profile a more detailed log I could look into this. I never had any problems with that but I also never send recurring invoices to a lot of customers simlulataniusly.

Anyway emails are getting send here at InvoicePlane with phpmailer (currently v6.1.4). I would recommend searching there for a problem with sending mails.

But at the same time: please search for patterns of the Mails which InvoicePlane could not send to. Maybe there is something they all have in common.

Thank you for the comment,

We upgraded to latest 1.5.11 back in June 2020 and noticed that about half of reoccurring invoices don’t get emailed and left as draft. So, about 30 invoices should be emailed in one cron run, the issue is that about 40% drafts and not sent. Never happened before upgrade.

To identify the cause, the log shows the unsent invoices as errors can’t sent (ERROR mentioned before as one of them for reference), since then we turned on debug, and trying to make sense of what happened with these errors by looking at the code can you tell where we can find the PHPMailer error info? and how to increase/change debug level in codebase or PHPMailer.

application/modules/mailer/helpers/phpmailer_helper.php

// And away it goes...
if ($mail->send()) {
    $CI->session->set_flashdata('alert_success', 'The email has been sent');
    return true;
} else {
    // Or not...
    $CI->session->set_flashdata('alert_error', $mail->ErrorInfo);
    return false;
}

The goal is to identify the root cause of the errors.

PHP 7.3.16 (cli) (built: Mar 17 2020 10:18:38) ( NTS )
CentOS Linux release 7.7.1908 (Core)

Sorry this apparently you should ask in the PHPMailer community. This programm just depends on it. Nothing about it has been changed.