diff --git a/CHANGELOG b/CHANGELOG index 172b853e5..9ad46bd5b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ CHANGELOG Roundcube Webmail - Managesieve: Replace "Filter disabled" with "Filter enabled" (#7028) - Managesieve: Fix so modifier type select wasn't hidden after hiding modifier select on header change - Managesieve: Fix filter selection after removing a first filter (#7079) +- Markasjunk: Fix marking more than one message as spam/ham with email_learn driver (#7121) - Password: Fix kpasswd and smb drivers' double-escaping bug (#7092) - Enigma: Add script to import keys from filesystem to the db storage (for multihost) - Installer: Fix DB Write test on SQLite database ("database is locked" error) (#7064) diff --git a/plugins/markasjunk/drivers/email_learn.php b/plugins/markasjunk/drivers/email_learn.php index 98df0eef0..b000448f5 100644 --- a/plugins/markasjunk/drivers/email_learn.php +++ b/plugins/markasjunk/drivers/email_learn.php @@ -45,6 +45,7 @@ class markasjunk_email_learn $from = $identity_arr['email']; $from_string = format_email_recipient($identity_arr['email'], $identity_arr['name']); $attach = $this->rcube->config->get('markasjunk_email_attach', false); + $debug = $this->rcube->config->get('markasjunk_debug'); $temp_dir = unslashify($this->rcube->config->get('temp_dir')); $mailto = $this->rcube->config->get($spam ? 'markasjunk_email_spam' : 'markasjunk_email_ham'); @@ -58,7 +59,7 @@ class markasjunk_email_learn $subject = $this->rcube->config->get('markasjunk_email_subject'); $subject = $this->_parse_vars($subject, $spam, $from); - foreach ($uids as $uid) { + foreach ($uids as $i => $uid) { $MESSAGE = new rcube_message($uid); $message_file = null; @@ -142,7 +143,7 @@ class markasjunk_email_learn )); } - $SENDMAIL->deliver_message($MAIL_MIME); + $SENDMAIL->deliver_message($MAIL_MIME, $i == count($uids) - 1); $message_file = $message_file ?: $MAIL_MIME->mailbody_file; // clean up @@ -150,11 +151,11 @@ class markasjunk_email_learn unlink($message_file); } - if ($this->rcube->config->get('markasjunk_debug')) { - rcube::write_log('', $uid . ($spam ? ' SPAM ' : ' HAM ') . $mailto . ' (' . $subject . ')'); + if ($debug) { + rcube::write_log('markasjunk', $uid . ($spam ? ' SPAM ' : ' HAM ') . $mailto . ' (' . $subject . ')'); if ($smtp_error['vars']) { - rcube::write_log('', $smtp_error['vars']); + rcube::write_log('markasjunk', $smtp_error['vars']); } } } diff --git a/program/include/rcmail_sendmail.php b/program/include/rcmail_sendmail.php index b90c23912..9ed65f756 100644 --- a/program/include/rcmail_sendmail.php +++ b/program/include/rcmail_sendmail.php @@ -362,11 +362,12 @@ class rcmail_sendmail /** * Message delivery, and setting Replied/Forwarded flag on success * - * @param Mail_mime $message Message object + * @param Mail_mime $message Message object + * @param bool $disconnect Close SMTP connection after delivery * * @return bool True on success, False on failure */ - public function deliver_message($message) + public function deliver_message($message, $disconnect = true) { // Handle Delivery Status Notification request $smtp_opts = array('dsn' => $this->options['dsn_enabled']); @@ -374,7 +375,7 @@ class rcmail_sendmail $sent = $this->rcmail->deliver_message($message, $this->options['from'], $this->options['mailto'], - $smtp_error, $mailbody_file, $smtp_opts, true + $smtp_error, $mailbody_file, $smtp_opts, $disconnect ); // return to compose page if sending failed