added dev.null.dk, visi.com, 2mbit.com, Leadmon, and NJABL blacklists
[squirrelmail.git] / src / delete_message.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * delete_message.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
65c3ec94 9 * Deletes a meesage from the IMAP server
35586184 10 *
11 * $Id$
12 */
ef870322 13
35586184 14require_once('../src/validate.php');
15require_once('../functions/display_messages.php');
16require_once('../functions/imap.php');
d3cdb279 17
65c3ec94 18$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
19
20sqimap_mailbox_select($imapConnection, $mailbox);
d4467150 21
65c3ec94 22sqimap_messages_delete($imapConnection, $message, $message, $mailbox);
23if ($auto_expunge) {
24 sqimap_mailbox_expunge($imapConnection, $mailbox, true);
25}
9c3e6cd4 26if (!isset($saved_draft)) {
27 $saved_draft = '';
28}
acaa9842 29
439166c1 30if (!isset($mail_sent)) {
31 $mail_sent = '';
32}
33
65c3ec94 34$location = get_location();
7058a2a9 35
65c3ec94 36if (isset($where) && isset($what)) {
37 header("Location: $location/search.php?where=" . urlencode($where) .
5e9e90fd 38 '&amp;what=' . urlencode($what) . '&amp;mailbox=' . urlencode($mailbox));
65c3ec94 39} else {
854000c0 40 if (!empty($saved_draft) || !empty($mail_sent)) {
5e9e90fd 41 header("Location: $location/compose.php?mail_sent=$mail_sent&amp;saved_draft=$saved_draft");
9c3e6cd4 42 }
43 else {
5e9e90fd 44 header("Location: $location/right_main.php?sort=$sort&amp;startMessage=$startMessage&amp;mailbox=" .
e02775fe 45 urlencode($mailbox));
9c3e6cd4 46 }
65c3ec94 47}
a48fbf9b 48
65c3ec94 49sqimap_logout($imapConnection);
e02775fe 50
5e9e90fd 51?>