diff --git a/backend/imap/config.php b/backend/imap/config.php index 8f8ca1da..db7a4030 100644 --- a/backend/imap/config.php +++ b/backend/imap/config.php @@ -55,6 +55,9 @@ define('IMAP_OPTIONS', '/notls/norsh'); +// Mark messages as read before deleting them +define('IMAP_AUTOSEEN_ON_DELETE', false); + // IMPORTANT: BASIC IMAP FOLDERS [ask your mail admin] // We can have diferent cases (case insensitive): diff --git a/backend/imap/imap.php b/backend/imap/imap.php index cbd4cf1e..60014dfc 100644 --- a/backend/imap/imap.php +++ b/backend/imap/imap.php @@ -1525,6 +1525,9 @@ public function DeleteMessage($folderid, $id, $contentparameters) { $this->imap_reopen_folder($folderImapid); if ($this->imap_inside_cutoffdate(Utils::GetCutOffDate($contentparameters->GetFilterType()), $id)) { + if (defined('IMAP_AUTOSEEN_ON_DELETE') && IMAP_AUTOSEEN_ON_DELETE == true) { + $s0 = @imap_setflag_full($this->mbox, $id, "\\Seen", FT_UID); + } $s1 = @imap_delete ($this->mbox, $id, FT_UID); $s11 = @imap_setflag_full($this->mbox, $id, "\\Deleted", FT_UID); $s2 = @imap_expunge($this->mbox);