- Issue created by @kallado
- 🇵🇹Portugal kallado
To add the variables to the SymfonyMailerQueueItem I think it shoul be somewere in QueueSendingEmailAdjuster
probably here:if (!$email->isInQueue()) { $queue = $this->queueFactory->get(SymfonyMailerQueueWorker::QUEUE_NAME, TRUE); $item = new SymfonyMailerQueueItem( $email->getType(), $email->getSubType(), $email->getParams(), $this->configuration, ); $queue->createItem($item);
Where we could use the Email method getVariables() to retrieve the values
- Status changed to Needs work
7 months ago 2:15pm 4 September 2024 - 🇩🇪Germany simonbaese Berlin
Thanks for the report. I am traveling right now. Will be able to get to the issue next week.
- 🇵🇹Portugal kallado
@simonbaese Thanks I'm available to help if you need to just a lot of work at the moment to dive into this.
- Assigned to simonbaese
- 🇩🇪Germany simonbaese Berlin
I checked the issue today. Building emails programmatically does not work correctly, as reported. Unfortunately, this applies not only to variables but also to other email properties. The issue stems from the Drupal Symfony Mailer overloading the responsibilities of the email object. Hence, the email object can not be serialized easily to pass data to the queue worker.
Probably, the only way forward is to carry all the build properties to the queue worker and reinstate them again. This approach is slightly ugly and I will sleep on it.
A workaround for now is to use an email builder plugin and delegate the assignment of variables to it.
Bumping to major priority because this bug affects all emails built in the described way.
- 🇩🇪Germany simonbaese Berlin
I am sorry for the delay. This issue is more complicated than expected because of the upstream architecture. If anyone has a good idea of how to approach this issue, please add your comments here.
- 🇩🇰Denmark styrbaek
This patch adds support for email variables in the symfony_mailer_queue module.
The changes include:
1. Adding $email->getVariables() in QueueSendingEmailAdjuster::build() method to ensure variables are stored in the queue
2. Adding 'variables' parameter to the SymfonyMailerQueueItem constructor with corresponding documentation
3. Implementing setVariables() in the processItem() method in SymfonyMailerQueueWorker
4. Defining the SYMFONY_MAILER_QUEUE_NAME constant and updating the QueueWorker annotationThese changes resolve the issue with missing email variables when emails are sent through the queue system, ensuring that all email data is properly transferred and processed.