-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Sales Emails Async Sending issue #16165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I suspect that it might be this commit that broke this in 2.2.4 by @RomaKis, although further checks should be made to be sure. There were changes made to the email senders to fix issue #11740. An unintended consequence of this commit is that if multiple emails are sent under the same process, i.e a cron process sending two or more emails at the same time, then the first email will succeed and the send on the remaining emails will fail with an exception. The exception is triggered here magento2/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php Line 50 in cc85cbe
After this change, new in 2.2.4, the message object is now static, and not cleared after each email is sent. The exception is triggered as the from header is being set on a message object that still has the from header set from the 1st email. I have several modules that provide massActions to send emails out, e.g resend order email, resend invoice email. These also fail in the same way on 2.2.4 and just send out the first email, if multiple emails are triggered. Reverting the above commit, fixes the issue for me. If you don't need the fix from #11740 then you can workaround this issue by reverting the above commit. |
PR #16461 is awaiting review and will fix this issue. |
@mihaifaget, thank you for your report. |
Fixed in 2.2-develop |
Hi @mihaifaget. Thank you for your report.
The fix will be available with the upcoming 2.3.1 release. |
Working on a clean magento 2.2.4.
Preconditions
Magento Version 2.2.4
Steps to reproduce
Enable Async sending from Stores->Configuration->Sales->Sales Emails->Asynchronous sending. Create 2(or more) orders. Run cron(twice if you don't already have sales_send_order_emails scheduled)
Expected result
An order email should be sent for each order in the queue.
Actual result
Only 1 email is sent for the first order in queue and marks all other orders as sent (email_sent in sales_order table)
The text was updated successfully, but these errors were encountered: