--- horde/imp/lib/Application.php.orig	2016-06-30 14:27:23.880324298 +0200
+++ horde/imp/lib/Application.php	2016-06-30 13:45:49.157182474 +0200
@@ -122,6 +122,10 @@
             $this->auth = array_diff($this->auth, array('add', 'list', 'remove'));
         }
 
+        /* Overwrite Horde_Mail to make sure settings in imp->config->smtp
+         * will be used. */
+        $injector->bindFactory('Horde_Mail', 'IMP_Factory_Mail', 'create');
+
         /* Set exception handler to handle uncaught
          * Horde_Imap_Client_Exceptions. */
         set_exception_handler(array($this, 'exceptionHandler'));
--- horde/imp/lib/Factory/Mail.php.orig	2016-07-01 00:35:10.984184340 +0200
+++ horde/imp/lib/Factory/Mail.php	2016-07-01 00:31:39.571469299 +0200
@@ -34,7 +34,7 @@
         if ($transport == 'smtp') {
             $params = array_merge(
                 $params,
-                $injector->getInstance('IMP_Factory_Imap')->create()->config->smtp
+                $injector->getInstance('IMP_Factory_Imap')->create()->config->smtp ?: []
             );
         }