Code Monkey home page Code Monkey logo

mailarchiver's Introduction

mailarchiver

Automatically sort your mails into a year-month folder structure.

If you are an inbox-zero user for years, your Archive folder will contain tens of thousands of mails, which causes problems with some mail user agents. This tool will sort your mails into a year-month folder structure, which has several advantages:

  • All mail user agents are capable of processing the folders
  • Search will be a lot faster, if you remember the year or the month of the mail you search
  • A much tidier and structured mail archive

Example folder structure

├── INBOX
├── Drafts
├── Sent
├── Archive
├── Junk
├── Trash
└── Archives
    ├── 2016
    │   ├── 01
    │   ├── 02
    │   ├── 03
    │   ├── ...
    │   └── 12
    ├── 2017
    |   ├── 01
    |   ├── 02
    |   ├── 03
    |   ├── ...
    |   └── 12
    └── ...

In this case, Archive is the archive folder used for inbox zero, and Archives contains the archive organized by mailarchiver.

Installation

Source

$ go get -u github.com/kolletzki/mailarchiver
$ cd $GOPATH/src/github.com/kolletzki/mailarchiver
$ go install .

Usage

mailarchiver is intended to be used from CLI.

Example

$ mailarchiver \
	--host imap.example.com \
	--port 993 \
	--user [email protected] \
	--archive Archives \
	--mbox Inbox \
	--rmbox Archives \
	--imbox Archives/Special \
	--skip-current \
	--dry

This will promt you for the IMAP password and then connect to imap.example.com on port 993 with the user [email protected] and the prompted password. It will then process the mailbox Inbox and Archives including all of it's nested mailboxes, except all mailboxes beginning with Archives/Special. No mails from the current month will be touched. For safety, this will be a dry run, meaning mailarchiver does not modify anything, however behaves as it'd do so.

Options

$ mailarchiver --help
NAME:
   Mailarchiver - Automatically sort your emails into a year-month folder structure

USAGE:
   mailarchiver.exe [global options] command [command options] [arguments...]

VERSION:
   0.9.0

COMMANDS:
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --host value, -H value        IMAP host
   --port value, -p value        IMAP port (default: 0)
   --user value, -u value        IMAP user
   --password value, --pw value  IMAP password (will be promted, if omitted)
   --archive value, -a value     Main archive folder
   --mbox value                  Mailboxes to process
   --rmbox value                 Mailboxes to process recursive
   --imbox value                 Mailboxes to ignore (overrides mbox and rmbox)
   --skip-current                Skip mails from current month
   --dry                         Performs a dry run, nothing will be changed on the IMAP server
   --help, -h                    show help
   --version, -v                 print the version

host, port, user and archive are mandatory options. In addition, you have to pass at least one mbox or rmbox option.

ToDo

  • enhance documentation
  • default values for config (port, archive, ...)
  • fallback for IMAP MOVE extension
  • add support for IMAP ID extension
  • allow password to be read from file
  • add support for a config file instead of CLI args
  • add support for non-ssl IMAP connections
  • add releases with binaries
  • enhance moving logic
  • enhance fetch logic
  • add tests

Gmail

Gmail classifies raw IMAP as "insecure access" by default. If you want to use mailarchiver with Gmail, you have to allow "less secure apps" in your Gmail settings.

Since I'm not using Gmail, I did not yet implement a better Gmail support to mailarchiver. If you want to add nice Gmail support, feel free to open a pull request. :)

License

GNU General Public License v3.0

See LICENSE for full license text.

mailarchiver's People

Contributors

lkstz avatar

Stargazers

Marius Karnauskas avatar Maximilian Ochs avatar Pascal Weiland avatar René Raab 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.