DragonByte Tech
Well-known member
- Affected version
- 2.0.7
Overnight, I woke to several server errors from the mail queue cron job, due to the emailTransport setting having randomly lost its password. These emails are now lost forever, with no way of recovering them, because of a critical design flaw in the mail queue.
The mail queue does not check whether there's an exception thrown, nor does it make any checks as to whether any recipient actually received the email. If no-one received the email or an exception was thrown, the mail gets discarded forever. This is obviously not correct, as it will lose important transactional emails such as registration emails.
Here's a proposed fix for
(Not sure if the logException is needed, but I added it just to be safe.)
This has not been tested yet, but I added the code to DBTech just now and will report back if anything changes.
Fillip
The mail queue does not check whether there's an exception thrown, nor does it make any checks as to whether any recipient actually received the email. If no-one received the email or an exception was thrown, the mail gets discarded forever. This is obviously not correct, as it will lose important transactional emails such as registration emails.
Here's a proposed fix for
src/XF/Mail/Queue.php
:
PHP:
try
{
$sent = $mailer->send($message);
}
catch (\Exception $e)
{
\XF::logException($e);
$sent = 0;
}
if (!$sent)
{
// Mail failed to send, retry later
$db->insert('xf_mail_queue', $record);
}
This has not been tested yet, but I added the code to DBTech just now and will report back if anything changes.
Fillip