Skip to content

An IMAP mailbox cleanup tool, to delete old emails from your IMAP mailboxes.

License

Notifications You must be signed in to change notification settings

n3wjack/ImapCleanup

Repository files navigation

IMAP Cleanup

IMAP Cleanup is a small .NET Core applicaton to delete emails from an IMAP inbox, leave only a number of most recent messages or delete emails inbetween a time range. You can thus also use this to delete all emails from an IMAP inbox.

It uses SSL by default to connect to the IMAP server.

Requirements

To run the application you can download the Windows x64 binary to run it without dependencies on a Windows 64-bit operating system. If you are on another platform, you need to install the .NET Core framework to be able to run the general framework dependent release.

Installing

  • Download the installer zip for your system. See Releases below. If you are running on a Windows x64 system (a recent machine running Windows 10 for example) you'll want to get the x64 self-contained zip. If in another case, get the framework dependent version. You will need to install .NET core for this.
  • Extract the zip file in a new folder somewhere.

For the self-contained version, the zip only contains a single executable. You can copy this file anywhere, and run it from there. For the framework version, it contains a number of other files, so it's better to keep this in it's own folder, and run the program from there.

Usage

Once built or installed, you can call the executable using command line arguments to point it to your IMAP inbox. This will delete all messages, except the 500 most recent ones:

.\ImapCleanup.exe count --keep 500 --hostname imap.mailserver.com --port 993 --username jack@foobar.com --password horsestaplebattery

Or you can delete all emails that have a timestamp between 11 'o clock in the evening and 6 in the morning:

.\ImapCleanup.exe time --from 23:00 --to 6:00 --hostname imap.mailserver.com --port 993 --username jack@foobar.com --password horsestaplebattery 

For help, just run .\ImapCleanup.exe for the available options. For help with one of the subcommands, use .\ImapCleanup.exe count or .\ImapCleanup.exe time

Releases

See releases

  • ImapCleanup-2.0.zip: framework dependent version. You need to have the .NET Core 8.0 framework installed to run this. This runs on any platform.
  • ImapCleanup-2.0-Windowsx64-self-contained.zip: a self-contained release for Windows x64 only. This runs without any dependencies.

Building

You need to have the .NET Core 6.0 SDK installed to build this. You can use Visual Studio Community edition to build it.

There are 3 way to build the project.

  1. Use Visual Studio.
  2. Run the build.cmd script to build a Windows 64-bit self-contained executable.
  3. Use the dotnet tool from the command line: dotnet build ImapCleanup.sln

Disclaimer

This tool deletes emails. USE AT YOUR OWN RISK.

This little tool works fine for me. It deletes the oldest messages, leaves the right ones and that's it. I haven't tested this thoroughly on every possible email server and IMAP configuration in the world. So if this ends up deleting vital emails, you're on your own I'm afraid. Before you point this to anything critical, test it on a dummy inbox with some test emails, just to be sure.

About

An IMAP mailbox cleanup tool, to delete old emails from your IMAP mailboxes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published