michael orlitzky


get it

The development version can be found in the git repository. Official releases are on the mailshears rubygems page.

What is it?

Managing a mail system with virtual users is annoying. The authoritative database of users is stored in one table, but every other piece of software keeps its own database of users.

If you're using PostfixAdmin to manage your users, what happens when you delete a user? Chances are, nothing happens: mail directories are left behind, webmail preferences are saved, address books become orphaned. That's what mailshears was designed to fix. It cleans up after you remove a user or domain.

Another stupidly difficult task is renaming a single email account. It's easy to move the user in one database, but then all of the remaining filesystem directories and databases need to be updated as well. Since these two tasks are related, mailshears does them both.


The main assumption we make is that your users are managed by postfix.admin. There are AgenDAV, filesystem, DAViCal, and Roundcube plugins available but they can be disabled. Note that AgenDAV upstream is dead; neither will mailshears support for it be eternal.


Step one is to get and install the code. With rubygems,

user $ gem install mailshears

Fetching: mailshears-0.0.2.gem (100%)

Successfully installed mailshears-0.0.2

Parsing documentation for mailshears-0.0.2

Installing ri documentation for mailshears-0.0.2

Done installing documentation for mailshears after 0 seconds

1 gem installed

Or in Gentoo,

user $ emerge mailshears

Once installed, you should create a config file by copying mailshears.example.conf.yml to ${HOME}/.mailshears.conf.yml and editing it to fit your environment.

How it works

Each plugin knows how to do three actions: prune, rename, and remove. Depending on how you invoke mailshears, it figured out which plugins need to be run and runs them in succession.

The prune mode additionally needs to access the postfix.admin database, since that's where the authoritative list of users and domains lives.

By default, mailshears doesn't actually do anything. There's a variable in the config file that you'll need to set before mailshears will touch your junk.

How to report bugs

Email them to me at michael@orlitzky.com.