Giter Club home page Giter Club logo

dovecot-autoclean's Introduction

dovecot-autoclean

Automatically deletes messages to trash or junk mail folder with a certain age

Dovecot is able to automatic delete emails, that are in the Trash and Junk/Spam folder, by the way, you can delete emails in other folders in the same way.

Clone git-repository

cd /root
git clone https://github.com/filipnet/dovecot-autoclean.git

Search for messages to delete (dry-run)

It is a good practice to first test which messages would be deleted before actually deleting them with "expunge".

doveadm search -u max.mustermann mailbox Trash savedbefore 5w

Delete messages oder than 5 weeks inside Folder Trash (manual)

doveadm expunge -u max.mustermann mailbox Trash savedbefore 5w

Delete messages oder than (automatically)

Create a bash script to perform the deletion automatically on a regular basis vim /root/dovecot-autoclean/dovecot_expunge.sh

#!/bin/bash
# which doveadm
DOVEADM="/usr/bin/doveadm";
$DOVEADM expunge -A mailbox Trash savedbefore 30d
$DOVEADM expunge -A mailbox Junk  savedbefore 90d

The script must be made executable with chmod +x /root/dovecot-autoclean/dovecot_expunge.sh Add the line below to /etc/crontab:

# This task always executes the script on the first day of the month
10 0 * * 1 root /root/dovecot-autoclean/dovecot_expunge.sh >/dev/null 2>&1

dovecot-autoclean's People

Contributors

filipnet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.