I'm in a process of integrating Magento 2 with email marketing, i want to stop some of the Magento 2 emails and use the email marketing instead. For example customer registration success, newsletter subscription success, and many others. Instead of creating a plugin or observer for each action, i just need one observer or plugin that can read the email template id and the email data, then stop the email from getting send. Is there a way to this?
Magento\Email\Model\Transport and the function
public function sendMessage() within this model is the deepest part where you can stop and reroute the email.
However, at this point you don't have anymore access to the Magento template identifier that is used. So, if you do need to interact with Magento data, I believe your next fallback is to customise the transportBuilder
I have to warn you this area of Magento is quite deep and coupled so there is no straight answer unless we have a thorough understanding of what exactly you are trying to achieve