- πΈπ¦Saudi Arabia samaphp Riyadh, SA πΈπ¦
It seems a real major issue for those who sending email messages using queue_mail.
It seems a well-known issue as per this link: https://www.drupal.org/project/drupal/issues/3085157 βWe've tried the renderRoot() but there is no luck, still fails.
We are using queue_mail module with this HTMLMail, so we had to come up with a workaround to execute the queue temporarily in a cronjob calling the browser URL from a controller to overcome this issue.$queueFactory = \Drupal::service('queue'); $queueManager = \Drupal::service('plugin.manager.queue_worker'); /** @var \Drupal\queue_mail\Plugin\QueueWorker\SendMailQueueWorker $queueWorker */ $queueWorker = $queueManager->createInstance('queue_mail'); /** @var \Drupal\Core\Queue\DatabaseQueue $queue */ $queue = $queueFactory->get('queue_mail'); if ($queue->numberOfItems() > 0) { // Get the number of items to process for ($i = 0; $i < $queue->numberOfItems(); $i++) { // Process the queue if ($item = $queue->claimItem()) { $workerResponse = $queueWorker->processItem($item->data); if (!empty($workerResponse) && !empty($workerResponse['result']) && ($workerResponse['result'] === TRUE)) { $queue->deleteItem($item); } else { // We will release it immediately. $queue->releaseItem($item); } } } }
CAUTION: This should be used only in cases where there are not too many emails, this is not a scalable solution and should be used only for small/experimental sites.