* Got bored and copied all the validate.php and define() stuff to 1.1
[squirrelmail.git] / src / delete_message.php
1 <?php
2 /**
3 ** delete_message.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Deletes a meesage from the IMAP server
9 **
10 ** $Id$
11 **/
12
13 include("../src/validate.php");
14 include("../functions/strings.php");
15 include("../config/config.php");
16 include("../functions/page_header.php");
17 include("../functions/display_messages.php");
18 include("../functions/imap.php");
19 include("../src/load_prefs.php");
20
21 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
22 sqimap_mailbox_select($imapConnection, $mailbox);
23
24 sqimap_messages_delete($imapConnection, $message, $message, $mailbox);
25 if ($auto_expunge)
26 sqimap_mailbox_expunge($imapConnection, $mailbox, true);
27
28 $location = get_location();
29 if (isset($where) && isset($what))
30 header ("Location: $location/search.php?where=".urlencode($where)."&what=".urlencode($what)."&mailbox=".urlencode($mailbox));
31 else
32 header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=".urlencode($mailbox));
33
34 sqimap_logout($imapConnection);
35 ?>