From bbc6a661ed0306e77b56edcb827f5a1f86ff3231 Mon Sep 17 00:00:00 2001 From: cytopia Date: Sun, 30 Jan 2022 14:27:08 +0100 Subject: [PATCH] Fixes #754 Be able to delete emails from control center --- .devilbox/www/htdocs/mail.php | 15 ++++++++++++++- .devilbox/www/include/lib/Mail.php | 12 ++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.devilbox/www/htdocs/mail.php b/.devilbox/www/htdocs/mail.php index 7e5df533..15817e2e 100644 --- a/.devilbox/www/htdocs/mail.php +++ b/.devilbox/www/htdocs/mail.php @@ -24,6 +24,17 @@ require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'mimeDeco require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mail.php'; require $LIB_DIR . DIRECTORY_SEPARATOR . 'Sort.php'; + +if (isset($_GET['delete']) && is_numeric($_GET['delete'])) { + $message = $_GET['delete']; + $MyMbox = new \devilbox\Mail('/var/mail/devilbox'); + $MyMbox->delete($message); + header('Location: /mail.php'); + exit(); +} + + + // // Setup Sort/Order // @@ -152,6 +163,7 @@ $messages = $MyMbox->get($sortOrderArr); From To Subject + Action @@ -180,11 +192,12 @@ $messages = $MyMbox->get($sortOrderArr); headers['from']);?> headers['x-original-to']);?> headers['subject']);?> + - + diff --git a/.devilbox/www/include/lib/Mail.php b/.devilbox/www/include/lib/Mail.php index 8a1353b7..ecfecabd 100644 --- a/.devilbox/www/include/lib/Mail.php +++ b/.devilbox/www/include/lib/Mail.php @@ -58,6 +58,18 @@ class Mail } + /** + * Deletes an emails + * + * Note: messages start with 0. + * + * @param int $message The number of the message to remove, or array of message ids to remove + */ + public function delete($message) { + $this->_Mbox->remove($message); + } + + /** * Retrieve emails. *