delete_email
This commit is contained in:
parent
a3f5c35406
commit
6249e959cd
|
@ -24,4 +24,21 @@ class ImapClient {
|
|||
$emails = _load_emails($mail_ids, $user);
|
||||
return $emails;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* deletes emails by id and username. The address must match the recipient in the email.
|
||||
*
|
||||
* @param $mailid integer imap email id
|
||||
* @param $user User
|
||||
* @internal param the $username matching username
|
||||
*/
|
||||
function delete_email(string $mailid, User $user) {
|
||||
if (_load_one_email($mailid, $user) !== null) {
|
||||
$this->mailbox->deleteMail($mailid);
|
||||
$this->mailbox->expungeDeletedMails();
|
||||
} else {
|
||||
error(404, 'delete error: invalid username/mailid combination');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,23 +40,6 @@ function error($status, $text) {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* deletes emails by id and username. The address must match the recipient in the email.
|
||||
*
|
||||
* @param $mailid integer imap email id
|
||||
* @param $user User
|
||||
* @internal param the $username matching username
|
||||
*/
|
||||
function delete_email($mailid, $user) {
|
||||
global $mailbox;
|
||||
|
||||
if (_load_one_email($mailid, $user) !== null) {
|
||||
$mailbox->deleteMail($mailid);
|
||||
$mailbox->expungeDeletedMails();
|
||||
} else {
|
||||
error(404, 'delete error: invalid username/mailid combination');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* download email by id and username. The $address must match the recipient in the email.
|
||||
|
|
|
@ -67,7 +67,7 @@ class DeleteEmailPage extends Page {
|
|||
$this->if_invalid_redirect_to_random($user, $this->config_domains);
|
||||
|
||||
$delete_email_id = filter_var($this->email_id, FILTER_SANITIZE_NUMBER_INT);
|
||||
delete_email($delete_email_id, $user);
|
||||
$imapClient->delete_email($delete_email_id, $user);
|
||||
header("location: ?" . $user->address);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user