Deprecated Behaviour

The inane, sometimes insane, ramblings from the mind of Brenton Alker.

Manually Deliver Email to Maildir

I have, on occasion, had need to manually drop an email into a users inbox. For example, when an over-zealous virus scanner dumps mail into “quarantine”.

After confirming that the email are, in fact, virus free, the emails are able to be injected into the users maildir with the help of safecat, which guarantees atomic copying (even from a slow standard input stream) and unique file naming.

The basic format of the command is:

1
2
3
4


safecat <tmp_dir> .Maildir/new/ < msg.eml

with the only restriction being that tmp_dir must be on the same file system, as the algorithm uses hard links to guarantee instant availability of the complete file.