:sparcles: added config delete_messages_older_than
This commit is contained in:
parent
18329f8c78
commit
de61a8fa29
|
@ -49,8 +49,7 @@ function print_emails($username, $address) {
|
||||||
function delete_email($mailid, $address) {
|
function delete_email($mailid, $address) {
|
||||||
global $mailbox;
|
global $mailbox;
|
||||||
|
|
||||||
$email = _load_one_email($mailid, $address);
|
if (_load_one_email($mailid, $address) !== null) {
|
||||||
if ($email !== null) {
|
|
||||||
$mailbox->deleteMail($mailid);
|
$mailbox->deleteMail($mailid);
|
||||||
$mailbox->expungeDeletedMails();
|
$mailbox->expungeDeletedMails();
|
||||||
header('Content-type: application/json');
|
header('Content-type: application/json');
|
||||||
|
@ -71,8 +70,7 @@ function delete_email($mailid, $address) {
|
||||||
function download_email($mailid, $address) {
|
function download_email($mailid, $address) {
|
||||||
global $mailbox;
|
global $mailbox;
|
||||||
|
|
||||||
$email = _load_one_email($mailid, $address);
|
if (_load_one_email($mailid, $address) !== null) {
|
||||||
if ($email !== null) {
|
|
||||||
header("Content-Type: message/rfc822; charset=utf-8");
|
header("Content-Type: message/rfc822; charset=utf-8");
|
||||||
header("Content-Disposition: attachment; filename=\"$address-$mailid.eml\"");
|
header("Content-Disposition: attachment; filename=\"$address-$mailid.eml\"");
|
||||||
|
|
||||||
|
@ -132,9 +130,9 @@ function _clean_username($username) {
|
||||||
* deletes messages older than X days.
|
* deletes messages older than X days.
|
||||||
*/
|
*/
|
||||||
function delete_old_messages() {
|
function delete_old_messages() {
|
||||||
global $mailbox;
|
global $mailbox, $config;
|
||||||
|
|
||||||
$ids = $mailbox->searchMailbox('BEFORE ' . date('d-M-Y', strtotime('30 days ago')));
|
$ids = $mailbox->searchMailbox('BEFORE ' . date('d-M-Y', strtotime($config['delete_messages_older_than'])));
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$mailbox->deleteMail($id);
|
$mailbox->deleteMail($id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,3 +19,6 @@ $config['imap']['password'] = "test";
|
||||||
|
|
||||||
// email domain, usually different from imap hostname:
|
// email domain, usually different from imap hostname:
|
||||||
$config['mailHostname'] = "example.com";
|
$config['mailHostname'] = "example.com";
|
||||||
|
|
||||||
|
// When to delete old messages?
|
||||||
|
$config['delete_messages_older_than'] = '30 days ago';
|
Loading…
Reference in New Issue
Block a user