diff --git a/modules/imap/hm-imap.php b/modules/imap/hm-imap.php index 85cb9bcd08..0dd9416955 100644 --- a/modules/imap/hm-imap.php +++ b/modules/imap/hm-imap.php @@ -353,7 +353,7 @@ public function get_capability() { */ public function get_special_use_mailboxes($type=false) { $folders = array(); - $types = array('trash', 'sent', 'flagged', 'all', 'junk'); + $types = array('trash', 'sent', 'flagged', 'all', 'junk', 'archive', 'drafts'); $command = 'LIST (SPECIAL-USE) "" "*"'."\r\n"; $this->send_command($command); $res = $this->get_response(false, true); diff --git a/modules/imap_folders/modules.php b/modules/imap_folders/modules.php index 1786a02917..5eec59c4f5 100644 --- a/modules/imap_folders/modules.php +++ b/modules/imap_folders/modules.php @@ -138,15 +138,25 @@ public function process() { Hm_Msgs('ERRUnable to connect to the selected IMAP server'); return; } - $specials = $this->user_config->get('special_imap_folders', array()); - if ($exposed = $imap->get_special_use_mailboxes()) { - $specials[$form['imap_server_id']] = array('sent' => $exposed['sent'], 'draft' => '', 'trash' => $exposed['trash'], 'archive' => '', 'junk' => ''); - } else if ($form['imap_service_name'] == 'gandi') { - $specials[$form['imap_server_id']] = array('sent' => 'Sent', 'draft' => 'Drafts', 'trash' => 'Trash', 'archive' => 'Archive', 'junk' => 'Junk'); + $exposed = $imap->get_special_use_mailboxes(); + if ($form['imap_service_name'] == 'gandi') { + $specials[$form['imap_server_id']] = array( + 'sent' => 'Sent', + 'draft' => 'Drafts', + 'trash' => 'Trash', + 'archive' => 'Archive', + 'junk' => 'Junk' + ); } else { - $specials[$form['imap_server_id']] = array('sent' => '', 'draft' => '', 'trash' => '', 'archive' => '', 'junk' => ''); - } + $specials[$form['imap_server_id']] = array( + 'sent' => $exposed['sent'] ?? '', + 'draft' => $exposed['drafts'] ?? '', + 'trash' => $exposed['trash'] ?? '', + 'archive' => $exposed['archive'] ?? '', + 'junk' => $exposed['junk'] ?? '' + ); + } $this->user_config->set('special_imap_folders', $specials); $user_data = $this->user_config->dump();