/** * Process messages list form and handle the cache gracefully. If $sButton and * $aUid are provided as argument then you can fake a message list submit and * use it i.e. in read_body.php for del move next and update the cache * * @param resource $imapConnection imap connection * @param array $aMailbox (reference) cached mailbox * @param string $sButton fake a submit button * @param array $aUid fake the $msg array * @return string $sError error string in case of an error * @author Marc Groot Koerkamp */ function handleMessageListForm($imapConnection, &$aMailbox, $sButton = '', $aUid = array()) { /* incoming formdata */ $sButton = sqgetGlobalVar('moveButton', $sTmp, SQ_POST) ? 'move' : $sButton; $sButton = sqgetGlobalVar('expungeButton', $sTmp, SQ_POST) ? 'expunge' : $sButton; $sButton = sqgetGlobalVar('attache', $sTmp, SQ_POST) ? 'attache' : $sButton; $sButton = sqgetGlobalVar('delete', $sTmp, SQ_POST) ? 'setDeleted' : $sButton; $sButton = sqgetGlobalVar('undeleteButton', $sTmp, SQ_POST) ? 'setDeleted' : $sButton; $sButton = sqgetGlobalVar('markRead', $sTmp, SQ_POST) ? 'setSeen' : $sButton; $sButton = sqgetGlobalVar('markUnread', $sTmp, SQ_POST) ? 'unsetSeen' : $sButton; $sButton = sqgetGlobalVar('markFlagged', $sTmp, SQ_POST) ? 'setFlagged' : $sButton; $sButton = sqgetGlobalVar('markUnflagged', $sTmp, SQ_POST) ? 'unsetFlagged' : $sButton; sqgetGlobalVar('targetMailbox', $targetMailbox, SQ_POST); sqgetGlobalVar('bypass_trash', $bypass_trash, SQ_POST); sqgetGlobalVar('msg', $msg, SQ_POST); $sError = ''; $mailbox = $aMailbox['NAME']; /* retrieve the check boxes */ $aUid = isset($msg) && is_array($msg) ? array_values($msg) : $aUid; if (count($aUid) && $sButton != 'expunge') { $aUpdatedMsgs = false; $bExpunge = false; switch ($sButton) { case 'setDeleted': // check if id exists in case we come from read_body if (count($aUid) == 1 && is_array($aMailbox['UIDSET'][$aMailbox['SETINDEX']]) && !in_array($aUid[0], $aMailbox['UIDSET'][$aMailbox['SETINDEX']])) { break; } $aUpdatedMsgs = sqimap_msgs_list_delete($imapConnection, $mailbox, $aUid, $bypass_trash); $bExpunge = true; break; case 'unsetDeleted': case 'setSeen': case 'unsetSeen': case 'setFlagged': case 'unsetFlagged': // get flag $sFlag = substr($sButton, 0, 3) == 'set' ? '\\' . substr($sButton, 3) : '\\' . substr($sButton, 5); $bSet = substr($sButton, 0, 3) == 'set' ? true : false; $aUpdatedMsgs = sqimap_toggle_flag($imapConnection, $aUid, $sFlag, $bSet, true); break; case 'move': $aUpdatedMsgs = sqimap_msgs_list_move($imapConnection, $aUid, $targetMailbox); sqsession_register($targetMailbox, 'lastTargetMailbox'); $bExpunge = true; break; case 'attache': $aMsgHeaders = array(); foreach ($aUid as $iUid) { $aMsgHeaders[$iUid] = $aMailbox['MSG_HEADERS'][$iUid]; } if (count($aMsgHeaders)) { $composesession = attachSelectedMessages($imapConnection, $aMsgHeaders); // dirty hack, add info to $aMailbox $aMailbox['FORWARD_SESSION'] = $composesession; } break; default: // Hook for plugin buttons do_hook_function('mailbox_display_button_action', $aUid); break; } /** * Updates messages is an array containing the result of the untagged * fetch responses send by the imap server due to a flag change. That * response is parsed in a array with msg arrays by the parseFetch function */ if ($aUpdatedMsgs) { // Update the message headers cache $aDeleted = array(); foreach ($aUpdatedMsgs as $iUid => $aMsg) { if (isset($aMsg['FLAGS'])) { /** * Only update the cached headers if the header is * cached. */ if (isset($aMailbox['MSG_HEADERS'][$iUid])) { $aMailbox['MSG_HEADERS'][$iUid]['FLAGS'] = $aMsg['FLAGS']; } /** * Count the messages with the \Delete flag set so we can determine * if the number of expunged messages equals the number of flagged * messages for deletion. */ if (isset($aMsg['FLAGS']['\\deleted']) && $aMsg['FLAGS']['\\deleted']) { $aDeleted[] = $iUid; } } } if ($bExpunge && $aMailbox['AUTO_EXPUNGE'] && ($iExpungedMessages = sqimap_mailbox_expunge($imapConnection, $aMailbox['NAME'], true))) { if (count($aDeleted) != $iExpungedMessages) { // there are more messages deleted permanently then we expected // invalidate the cache $aMailbox['UIDSET'][$aMailbox['SETINDEX']] = false; $aMailbox['MSG_HEADERS'] = false; } else { // remove expunged messages from cache $aUidSet = $aMailbox['UIDSET'][$aMailbox['SETINDEX']]; if (is_array($aUidSet)) { // create a UID => array index temp array $aUidSetDummy = array_flip($aUidSet); foreach ($aDeleted as $iUid) { // get the id as well in case of SQM_SORT_NONE if ($aMailbox['SORT'] == SQSORT_NONE) { $aMailbox['ID'] = false; //$iId = $aMailbox['MSG_HEADERS'][$iUid]['ID']; //unset($aMailbox['ID'][$iId]); } // unset the UID and message header unset($aUidSetDummy[$iUid]); unset($aMailbox['MSG_HEADERS'][$iUid]); } $aMailbox['UIDSET'][$aMailbox['SETINDEX']] = array_keys($aUidSetDummy); } } // update EXISTS info if ($iExpungedMessages) { $aMailbox['EXISTS'] -= (int) $iExpungedMessages; } // Change the startMessage number if the mailbox was changed if ($aMailbox['PAGEOFFSET'] - 1 >= $aMailbox['EXISTS']) { $aMailbox['PAGEOFFSET'] = $aMailbox['PAGEOFFSET'] > $aMailbox['LIMIT'] ? $aMailbox['PAGEOFFSET'] - $aMailbox['LIMIT'] : 1; $aMailbox['OFFSET'] = $aMailbox['PAGEOFFSET'] - 1; } } } } else { if ($sButton == 'expunge') { /** * on expunge we do not know which messages will be deleted * so it's useless to try to sync the cache * Close the mailbox so we do not need to parse the untagged expunge * responses which do not contain uid info. * NB: Closing a mailbox is faster then expunge because the imap * server does not need to generate the untagged expunge responses */ sqimap_run_command($imapConnection, 'CLOSE', false, $result, $message); $aMbxResponse = sqimap_mailbox_select($imapConnection, $aMailbox['NAME']); // update the $aMailbox array $aMailbox['EXISTS'] = $aMbxResponse['EXISTS']; $aMailbox['UIDSET'] = false; } else { if ($sButton) { $sError = _("No messages were selected."); } } } return $sError; }
if (count($id)) { sqimap_toggle_flag($imapConnection, $id, '\\Deleted', false, true); } else { $exception = true; } } elseif (!isset($moveButton)) { if (count($id)) { $cnt = count($id); if (!isset($attache)) { if (isset($markRead)) { sqimap_toggle_flag($imapConnection, $id, '\\Seen', true, true); } else { if (isset($markUnread)) { sqimap_toggle_flag($imapConnection, $id, '\\Seen', false, true); } else { sqimap_msgs_list_delete($imapConnection, $mailbox, $id); if ($auto_expunge) { $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true); } if ($startMessage + $cnt - 1 >= $mbx_response['EXISTS']) { if ($startMessage > $show_num) { $location = set_url_var($location, 'startMessage', $startMessage - $show_num, false); } else { $location = set_url_var($location, 'startMessage', 1, false); } } } } } else { $composesession = attachSelectedMessages($id, $imapConnection); $location = set_url_var($location, 'session', $composesession, false);
function bayesspam_prune($args) { if ($args[0] != 'left_main_before' || !isset($_SESSION['just_logged_in']) || $_SESSION['just_logged_in'] != true) { return; } if ($GLOBALS['bayesdbhandle'] == null) { return; } if ($GLOBALS['bayesspam_prune_threshold'] == 0) { return; } $secsago = 86400 * ($GLOBALS['bayesspam_prune_threshold'] - 1); /* Convert days to seconds */ $cutoffdate = date('d-M-Y', time() - $secsago); if (!sqimap_mailbox_exists($GLOBALS['imapConnection'], $GLOBALS['bayesspam_folder'])) { return; } $notrash = false; if (!sqimap_mailbox_exists($GLOBALS['imapConnection'], $GLOBALS['trash_folder'])) { $notrash = true; } else { $trashbox = sqimap_mailbox_select($GLOBALS['imapConnection'], $GLOBALS['trash_folder']); if (strtolower($trashbox['RIGHTS']) != "read-write") { $notrash = true; } } $mbx = sqimap_mailbox_select($GLOBALS['imapConnection'], $GLOBALS['bayesspam_folder']); if (strtolower($mbx['RIGHTS']) != "read-write") { return; } $query = "SEARCH SENTBEFORE {$cutoffdate}"; $read = sqimap_run_command($GLOBALS['imapConnection'], $query, TRUE, $response, $message, $GLOBALS['uid_support']); $results = str_replace(' ', ',', substr($read[0], 9)); $msglist = trim($results); /* get rid of that nasty whitespace */ if (strlen($msglist) < 1) { return; } $msglist = sqimap_message_list_squisher(explode(' ', $msglist)); if (!$notrash && $GLOBALS['default_move_to_trash']) { sqimap_msgs_list_move($GLOBALS['imapConnection'], $msglist, $GLOBALS['trash_folder']); } else { sqimap_msgs_list_delete($GLOBALS['imapConnection'], $GLOBALS['bayesspam_folder'], $msglist); } if ($GLOBALS['auto_expunge']) { sqimap_mailbox_expunge($GLOBALS['imapConnection'], $GLOBALS['bayesspam_folder']); } }
/** * Process messages list form and handle the cache gracefully. If $sButton and * $aUid are provided as argument then you can fake a message list submit and * use it i.e. in read_body.php for del move next and update the cache * * @param resource $imapConnection imap connection * @param array $aMailbox (reference) cached mailbox * @param string $sButton fake a submit button * @param array $aUid fake the $msg array * @param string $targetMailbox fake the target mailbox for move operations * @param boolean $bypass_trash fake the bypass trash checkbox for delete operations * @return string $sError error string in case of an error * @since 1.5.1 * @author Marc Groot Koerkamp */ function handleMessageListForm($imapConnection, &$aMailbox, $sButton = '', $aUid = array(), $targetMailbox = '', $bypass_trash = NULL) { /* incoming formdata */ $sButton = sqgetGlobalVar('moveButton', $sTmp, SQ_FORM) ? 'move' : $sButton; $sButton = sqgetGlobalVar('copyButton', $sTmp, SQ_FORM) ? 'copy' : $sButton; $sButton = sqgetGlobalVar('expungeButton', $sTmp, SQ_FORM) ? 'expunge' : $sButton; $sButton = sqgetGlobalVar('forward', $sTmp, SQ_FORM) ? 'forward' : $sButton; $sButton = sqgetGlobalVar('delete', $sTmp, SQ_FORM) ? 'setDeleted' : $sButton; $sButton = sqgetGlobalVar('undeleteButton', $sTmp, SQ_FORM) ? 'unsetDeleted' : $sButton; $sButton = sqgetGlobalVar('markRead', $sTmp, SQ_FORM) ? 'setSeen' : $sButton; $sButton = sqgetGlobalVar('markUnread', $sTmp, SQ_FORM) ? 'unsetSeen' : $sButton; $sButton = sqgetGlobalVar('markFlagged', $sTmp, SQ_FORM) ? 'setFlagged' : $sButton; $sButton = sqgetGlobalVar('markUnflagged', $sTmp, SQ_FORM) ? 'unsetFlagged' : $sButton; if (empty($targetMailbox)) { sqgetGlobalVar('targetMailbox', $targetMailbox, SQ_FORM); } if (is_null($bypass_trash)) { sqgetGlobalVar('bypass_trash', $bypass_trash, SQ_FORM); } sqgetGlobalVar('msg', $msg, SQ_FORM); if (sqgetGlobalVar('account', $iAccount, SQ_FORM) === false) { $iAccount = 0; } $sError = ''; $mailbox = $aMailbox['NAME']; /* retrieve the check boxes */ $aUid = isset($msg) && is_array($msg) ? array_values($msg) : $aUid; if (count($aUid) && $sButton != 'expunge') { // don't do anything to any messages until we have done security check // FIXME: not sure this code really belongs here, but there's nowhere else to put it with this architecture sqgetGlobalVar('smtoken', $submitted_token, SQ_FORM, ''); sm_validate_security_token($submitted_token, -1, TRUE); // make sure message UIDs are sanitized (BIGINT) foreach ($aUid as $i => $uid) { $aUid[$i] = preg_match('/^[0-9]+$/', $uid) ? $uid : '0'; } $aUpdatedMsgs = false; $bExpunge = false; switch ($sButton) { case 'setDeleted': // check if id exists in case we come from read_body if (count($aUid) == 1 && is_array($aMailbox['UIDSET'][$aMailbox['SETINDEX']]) && !in_array($aUid[0], $aMailbox['UIDSET'][$aMailbox['SETINDEX']])) { break; } $aUpdatedMsgs = sqimap_msgs_list_delete($imapConnection, $mailbox, $aUid, $bypass_trash); $bExpunge = true; //} break; case 'unsetDeleted': case 'setSeen': case 'unsetSeen': case 'setFlagged': case 'unsetFlagged': // get flag $sFlag = substr($sButton, 0, 3) == 'set' ? '\\' . substr($sButton, 3) : '\\' . substr($sButton, 5); $bSet = substr($sButton, 0, 3) == 'set' ? true : false; $aUpdatedMsgs = sqimap_toggle_flag($imapConnection, $aUid, $sFlag, $bSet, true); break; case 'move': $aUpdatedMsgs = sqimap_msgs_list_move($imapConnection, $aUid, $targetMailbox, true, $mailbox); sqsession_register($targetMailbox, 'lastTargetMailbox'); $bExpunge = true; break; case 'copy': // sqimap_msgs_list_copy returns true or false. // If error happens - fourth argument handles it inside function. sqimap_msgs_list_copy($imapConnection, $aUid, $targetMailbox, true); sqsession_register($targetMailbox, 'lastTargetMailbox'); break; case 'forward': $aMsgHeaders = array(); foreach ($aUid as $iUid) { $aMsgHeaders[$iUid] = $aMailbox['MSG_HEADERS'][$iUid]; } if (count($aMsgHeaders)) { $composesession = attachSelectedMessages($imapConnection, $aMsgHeaders); // dirty hack, add info to $aMailbox $aMailbox['FORWARD_SESSION']['SESSION_NUMBER'] = $composesession; $aMailbox['FORWARD_SESSION']['UIDS'] = $aUid; } break; default: // Hook for plugin buttons $temp = array(&$sButton, &$aMailbox, $iAccount, $aMailbox['NAME'], &$aUid); do_hook('mailbox_display_button_action', $temp); break; } /** * $aUpdatedMsgs is an array containing the result of the untagged * fetch responses send by the imap server due to a flag change. That * response is parsed in an array with msg arrays by the parseFetch function */ if ($aUpdatedMsgs) { // Update the message headers cache $aDeleted = array(); foreach ($aUpdatedMsgs as $iUid => $aMsg) { if (isset($aMsg['FLAGS'])) { /** * Only update the cached headers if the header is * cached. */ if (isset($aMailbox['MSG_HEADERS'][$iUid])) { $aMailbox['MSG_HEADERS'][$iUid]['FLAGS'] = $aMsg['FLAGS']; } /** * Also update flags in message object */ //FIXME: WHY are we keeping flags in TWO places?!? This is error-prone and some core code uses the is_xxxx message object values while other code uses the flags array above. That's a mess. if (isset($aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT'])) { $message = $aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT']; $message->is_seen = false; $message->is_answered = false; $message->is_forwarded = false; $message->is_deleted = false; $message->is_flagged = false; $message->is_mdnsent = false; foreach ($aMsg['FLAGS'] as $flag => $value) { if (strtolower($flag) == '\\seen' && $value) { $message->is_seen = true; } else { if (strtolower($flag) == '\\answered' && $value) { $message->is_answered = true; } else { if (strtolower($flag) == '$forwarded' && $value) { $message->is_forwarded = true; } else { if (strtolower($flag) == '\\deleted' && $value) { $message->is_deleted = true; } else { if (strtolower($flag) == '\\flagged' && $value) { $message->is_flagged = true; } else { if (strtolower($flag) == '$mdnsent' && $value) { $message->is_mdnsent = true; } } } } } } } $aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT'] = $message; } /** * Count the messages with the \Delete flag set so we can determine * if the number of expunged messages equals the number of flagged * messages for deletion. */ if (isset($aMsg['FLAGS']['\\deleted']) && $aMsg['FLAGS']['\\deleted']) { $aDeleted[] = $iUid; } } } if ($bExpunge && $aMailbox['AUTO_EXPUNGE'] && ($iExpungedMessages = sqimap_mailbox_expunge($imapConnection, $aMailbox['NAME'], true))) { if (count($aDeleted) != $iExpungedMessages) { // there are more messages deleted permanently then we expected // invalidate the cache $aMailbox['UIDSET'][$aMailbox['SETINDEX']] = false; $aMailbox['MSG_HEADERS'] = false; } else { // remove expunged messages from cache $aUidSet = $aMailbox['UIDSET'][$aMailbox['SETINDEX']]; if (is_array($aUidSet)) { // create a UID => array index temp array $aUidSetDummy = array_flip($aUidSet); foreach ($aDeleted as $iUid) { // get the id as well in case of SQM_SORT_NONE if ($aMailbox['SORT'] == SQSORT_NONE) { $aMailbox['ID'] = false; //$iId = $aMailbox['MSG_HEADERS'][$iUid]['ID']; //unset($aMailbox['ID'][$iId]); } // unset the UID and message header unset($aUidSetDummy[$iUid]); unset($aMailbox['MSG_HEADERS'][$iUid]); } $aMailbox['UIDSET'][$aMailbox['SETINDEX']] = array_keys($aUidSetDummy); } } // update EXISTS info if ($iExpungedMessages) { $aMailbox['EXISTS'] -= (int) $iExpungedMessages; $aMailbox['TOTAL'][$aMailbox['SETINDEX']] -= (int) $iExpungedMessages; } if ($aMailbox['PAGEOFFSET'] - 1 >= $aMailbox['EXISTS']) { $aMailbox['PAGEOFFSET'] = $aMailbox['PAGEOFFSET'] > $aMailbox['LIMIT'] ? $aMailbox['PAGEOFFSET'] - $aMailbox['LIMIT'] : 1; $aMailbox['OFFSET'] = $aMailbox['PAGEOFFSET'] - 1; } } } } else { if ($sButton == 'expunge') { /** * on expunge we do not know which messages will be deleted * so it's useless to try to sync the cache * * Close the mailbox so we do not need to parse the untagged expunge * responses which do not contain uid info. * NB: Closing a mailbox is faster then expunge because the imap * server does not need to generate the untagged expunge responses */ sqimap_run_command($imapConnection, 'CLOSE', false, $result, $message); $aMailbox = sqm_api_mailbox_select($imapConnection, $iAccount, $aMailbox['NAME'], array(), array()); } else { // this is the same hook as above, but here it is called in the // context of not having had any messages selected and if any // plugin handles the situation, it should return TRUE so we // know this was not an erroneous user action // global $null; $temp = array(&$sButton, &$aMailbox, $iAccount, $aMailbox['NAME'], $null); if (!boolean_hook_function('mailbox_display_button_action', $temp, 1) && $sButton) { $sError = _("No messages were selected."); } } } return $sError; }
function delete_move_next_delete() { global $imapConnection, $auto_expunge; sqgetGlobalVar('delete_id', $delete_id, SQ_GET); sqgetGlobalVar('mailbox', $mailbox, SQ_GET); sqimap_msgs_list_delete($imapConnection, $mailbox, $delete_id); if ($auto_expunge) { delete_move_expunge_from_all($delete_id); // sqimap_mailbox_expunge($imapConnection, $mailbox, true); } }
} if (isset($_GET['where'])) { $where = urlencode($_GET['where']); } if (isset($_GET['what'])) { $what = urlencode($_GET['what']); } if (isset($_GET['sort'])) { $sort = (int) $_GET['sort']; } if (isset($_GET['startMessage'])) { $startMessage = (int) $_GET['startMessage']; } $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); sqimap_mailbox_select($imapConnection, $mailbox); sqimap_msgs_list_delete($imapConnection, $mailbox, $message); if ($auto_expunge) { sqimap_mailbox_expunge($imapConnection, $mailbox, true); } sqimap_logout($imapConnection); if (!isset($saved_draft)) { $saved_draft = ''; } if (!isset($mail_sent)) { $mail_sent = ''; } $location = get_location(); if (isset($where) && isset($what)) { header("Location: {$location}/search.php?where=" . $where . '&what=' . $what . '&mailbox=' . urlencode($mailbox)); } else { if (!empty($saved_draft) || !empty($mail_sent)) {
/** * Process messages that are submitted by email. * * Delete spam if user wants to delete it. Don't save submitted emails. * Implement overrides that fix compose.php behavior. * @since 1.5.1 * @access private */ function spamcop_while_sending_function() { global $mailbox, $spamcop_delete, $spamcop_save, $spamcop_is_composing, $auto_expunge, $username, $imapServerAddress, $imapPort, $imap_stream_options; if (sqgetGlobalVar('spamcop_is_composing', $spamcop_is_composing)) { // delete spam message if ($spamcop_delete) { $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options); sqimap_mailbox_select($imapConnection, $mailbox); sqimap_msgs_list_delete($imapConnection, $mailbox, array($spamcop_is_composing)); if ($auto_expunge) { sqimap_mailbox_expunge($imapConnection, $mailbox, true); } } if (!$spamcop_save) { // disable use of send folder. // Temporally override in order to disable saving of 'reply anyway' messages. global $default_move_to_sent; $default_move_to_sent = false; } // change default email composition setting. Plugin always operates in right frame. // make sure that compose.php redirects to right page. Temporally override. global $compose_new_win; $compose_new_win = false; } }
// $composeMessage as args #2 and #3 to being in an array // under arg #2 $temp = array(&$Result, &$composeMessage, &$mail_sent); do_hook('compose_send_after', $temp); if (!$Result) { showInputForm($session); exit; } /* if it is resumed draft, delete draft message */ if (isset($delete_draft)) { $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, false, $imap_stream_options); sqimap_mailbox_select($imap_stream, $draft_folder); // bypass_trash=true because message should be saved when deliverMessage() returns true. // in current implementation of sqimap_msgs_list_flag() single message id can // be submitted as string. docs state that it should be array. sqimap_msgs_list_delete($imap_stream, $draft_folder, $delete_draft, true); if ($auto_expunge) { sqimap_mailbox_expunge($imap_stream, $draft_folder, true); } sqimap_logout($imap_stream); } /* * Store the error array in the session because they will be lost on a redirect */ $oErrorHandler->saveDelayedErrors(); session_write_close(); if ($compose_new_win == '1') { if (!isset($pageheader_sent) || !$pageheader_sent) { header("Location: {$location}/compose.php?mail_sent={$mail_sent}"); } else { //FIXME: DON'T ECHO HTML FROM CORE!
function spamcop_while_sending() { global $mailbox, $spamcop_delete, $auto_expunge, $username, $key, $imapServerAddress, $imapPort; // load sqgetGlobalVar() include_once SM_PATH . 'functions/global.php'; // check if compose.php is called by spamcop plugin if (sqgetGlobalVar('spamcop_is_composing', $spamcop_is_composing)) { if ($spamcop_delete) { $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); sqimap_mailbox_select($imapConnection, $mailbox); sqimap_msgs_list_delete($imapConnection, $mailbox, $spamcop_is_composing); if ($auto_expunge) { sqimap_mailbox_expunge($imapConnection, $mailbox, true); } } // change default email composition setting. Plugin always operates in right frame. // make sure that compose.php redirects to right page. Temporally override. global $compose_new_win; $compose_new_win = false; } }