What is the best way to resolve di conflicts in Magento 2?
It's the same problem like in M1 if modules overwrite the same class. You've to implement your own class which consolidate the changes of all conflicting modules in order to resolve it.
Your basic module structure
- app/code/YourNamespace
|- ConflictResolver
|- etc
| |- module.xml
| |- di.xml
|- Model
| |- YourClass.php
|- composer.json
|- registration.php
Your module structure should look something like this. The third party and Magento modules are located in vendor directory... If not see here for how to setup a Magento 2 project: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/integrator_install_ce.html
In the module.xml
you have to define the sequence for your module loading
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="YourNamespace_ConflictResolver" setup_version="1.0.0">
<sequence>
<module name="ThirdParty_ModuleA" />
<module name="ThirdParty_ModuleB" />
<module name="Magento_ModuleA" />
</sequence>
</module>
</config>
In this example your module would be loaded after the three modules listed in the sequence
node and your DI config will overrule the previous loaded...
See this page for more details: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/module-load-order.html
However this is not the preferred way of the Magento Engineers. Plugins have better compatibility and if a module overwrites by using preferences this is a sign for less quality... Of course I understand, that there is in some cases no other way because the core it self does not follow Magento 2 standards in most modules.
The Future...
I've told with some core developers about further engineering ideas and concepts. The new way to go will be that all modules will be separate into API / service contracts and (final; final is not really possible because of the autogenerated classes) implementation so there will be interfaces for everything, but you can't extend from core and have to implement your own logic... For your problem this would mean that you have to implement an own class which includes the right interface(s) anyway...
Edit: Alan Kent just published something about this: https://community.magento.com/t5/Magento-DevBlog/Service-Contracts-in-Separate-Packages/ba-p/68129
Make your class extend the dot mailer one. And declare your module to be loaded after the dot mailer module in module.xml.