c01eb969014935b7763ae7bb11e98e14531f7f66
6 * Copyright (c) 1999-2004 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Deletes a meesage from the IMAP server
12 * @package squirrelmail
15 /** Path for SquirrelMail required files. */
16 define('SM_PATH','../');
18 /* SquirrelMail required files. */
19 require_once(SM_PATH
. 'include/validate.php');
20 require_once(SM_PATH
. 'functions/display_messages.php');
21 require_once(SM_PATH
. 'functions/imap.php');
24 sqgetGlobalVar('username', $username, SQ_SESSION
);
25 sqgetGlobalVar('key', $key, SQ_COOKIE
);
26 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION
);
28 sqgetGlobalVar('message', $message, SQ_GET
);
29 sqgetGlobalVar('mailbox', $mailbox, SQ_GET
);
31 sqgetGlobalVar('bypass_trash', $bypass_trash, SQ_GET
);
35 if (isset($_GET['saved_draft'])) {
36 $saved_draft = urlencode($_GET['saved_draft']);
38 if (isset($_GET['mail_sent'])) {
39 $mail_sent = urlencode($_GET['mail_sent']);
41 if (isset($_GET['sort'])) {
42 $sort = (int) $_GET['sort'];
45 if (isset($_GET['startMessage'])) {
46 $startMessage = (int) $_GET['startMessage'];
49 if(isset($_GET['where'])) {
50 $where = urlencode($_GET['where']);
52 if(isset($_GET['what'])) {
53 $what = urlencode($_GET['what']);
56 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
58 sqimap_mailbox_select($imapConnection, $mailbox);
60 sqimap_messages_delete($imapConnection, $message, $message, $mailbox,$bypass_trash);
62 sqimap_mailbox_expunge($imapConnection, $mailbox, true);
64 if (!isset($saved_draft)) {
68 if (!isset($mail_sent)) {
72 $location = get_location();
74 if (isset($where) && isset($what)) {
75 header("Location: $location/search.php?where=" . $where .
76 '&what=' . $what . '&mailbox=' . urlencode($mailbox));
78 if (!empty($saved_draft) ||
!empty($mail_sent)) {
79 header("Location: $location/compose.php?mail_sent=$mail_sent&saved_draft=$saved_draft");
82 header("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=" .
87 sqimap_logout($imapConnection);