diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 4ac54072e..977f7784a 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1578,10 +1578,12 @@ class rcube * @param string $body_file Location of file with saved message body (reference), * used when delay_file_io is enabled * @param array $options SMTP options (e.g. DSN request) + * @param bool $disconnect Close SMTP connection ASAP * * @return boolean Send status. */ - public function deliver_message(&$message, $from, $mailto, &$error, &$body_file = null, $options = null) + public function deliver_message(&$message, $from, $mailto, &$error, + &$body_file = null, $options = null, $disconnect = false) { $plugin = $this->plugins->exec_hook('message_before_send', array( 'message' => $message, @@ -1681,6 +1683,10 @@ class rcube fclose($msg_body); } + if ($disconnect) { + $this->smtp->disconnect(); + } + $message->headers($headers, true); return $sent; diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 3f9503afa..19d7e7a8a 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1910,7 +1910,7 @@ function rcmail_send_mdn($message, &$smtp_error) // SMTP options $options = array('mdn_use_from' => (bool) $RCMAIL->config->get('mdn_use_from')); - $sent = $RCMAIL->deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options); + $sent = $RCMAIL->deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options, true); if ($sent) { $RCMAIL->storage->set_flag($message->uid, 'MDNSENT'); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index e5e461c08..afaa7ac84 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -537,7 +537,7 @@ if (!$savedraft && !$saveonly) { $smtp_opts['dsn'] = $dsn_enabled; $sent = $RCMAIL->deliver_message($MAIL_MIME, $from, $mailto, - $smtp_error, $mailbody_file, $smtp_opts); + $smtp_error, $mailbody_file, $smtp_opts, true); // return to compose page if sending failed if (!$sent) {