You can disable sending email for admin and frontend from admin [Store > Configuration > Sales > Sales Email] of order confirmation and later you can use this event observer.
Check my answer from here how to send email for this event :
Hey @gaurav_harsh1 and @Nishu Jindal
I tried made an invoice and the Invoice email is not sent too, I checked the logs and in debug.log the only thing that showed there when I tried to send the email was
main.DEBUG: cache_invalidate: {"method":"POST","url":"base_url/admin/sales/order_invoice/save/order_id/74042/key/a5691a6cbb4879becd1e8f0be36dfb64aa2cf20715f361d0a33940ff5515499b/","invalidateInfo":{"tags":["rma_order_status_history"],"mode":"matchingAnyTag"}} [] main.DEBUG: cache_invalidate: {"method":"POST","url":"base_url/admin/sales/order_invoice/save/order_id/74042/key/a5691a6cbb4879becd1e8f0be36dfb64aa2cf20715f361d0a33940ff5515499b/","invalidateInfo":{"tags":["rma_order_status_history_7873","FPC"],"mode":"matchingTag"}} [] main.DEBUG: cache_invalidate: {"method":"POST","url":"base_url/admin/sales/order_invoice/save/order_id/74042/key/a5691a6cbb4879becd1e8f0be36dfb64aa2cf20715f361d0a33940ff5515499b/","invalidateInfo":{"tags":["rma_order_status_history_7873","FPC"],"mode":"matchingTag"}} []
Can it be something from this? I recently upgraded from 2.2.7 to 2.3.5-p1 if it's relevant.
Thanks
Hi @rui_silva1,
Are you using any custom extension related to the RMA in your store? If yes, can you please disable that extension and try your Order and Invoice Email triggered to the customer or not.
Hope this helps you!
Problem Solved! Click Kudos & Accept as Solution!
I think you're using localhost as domain, if Yes, please try to change base URL with your IP and then try.
Hey @gaurav_harsh1 ,
It's not localhost, I just changed it's a long base url because it's generated based on the environment name.
But even in that case wouldn't that "block" the frontend email sending too?
Thanks
Hey @gaurav_harsh1 and @Nishu Jindal ,
I tried to disable Asynchronous sending and all email were sent at the same time. There's the problem, I should've database cron_schedule and not the email log I guess.
But with this why emails from admin are becoming pending and the other don't?
Thanks
Thanks I got it.
The base crons from magento were not properly installed so they weren't running properly and all things were pending all the time.
So the error you shared was not related to the issue you are getting.
I didn't know if it were or not, it was the only error that showed at the time I tried to send the email so I thought it could be related but it wasn't I'm getting to that error now to see what it's causing it but not related to this issue, sorry for the miss lead there!
Thanks for everything!