Markasjunk: Fix marking more than one message as spam/ham with email_learn driver (#7121)

pull/7135/head
Aleksander Machniak 5 years ago
parent 5f30dc68a3
commit 226097fc3f

@ -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)

@ -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']);
}
}
}

@ -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

Loading…
Cancel
Save