AttachCheck

Author: Benjamin Mako Hill <mako@debian.org>
Date: Mon, 4 Jul 2005 04:42:03 -0400
Copyright: GNU General Public License

How many times have you said, "I've attached the file below," and then failed to actually attach the file? It happens to even the best of us.

AtttachCheck is a program that seeks to end this forever. AttachCheck looks through all outgoing mail. If it expects an attachment and doesn't see one, it refuses to send it until you confirm that you really want to send the message sans attachment.

AttachCheck It was written in Benjamin Mako Hill. You can find the latest version of this program, more information, and some of Mako's sometime accidentally insightful or useful ideas at his eponymous homepage at: http://mako.cc

Prerequisites

If you use OutLook and Windows, I found a similar program for that setup: http://www.danevans.co.uk/vba/

How AttachCheck Works

AttachCheck monitors outgoing mail for keywords. It expects attachment if it finds a text-based attachment if it finds one of the following words:

If you can think of other words (in any language) that are indicative of attachments, please contact the author of the program so others can benefit as well.

AttachCheck is basically just a wrapper for your mail transfer agent (MTA). It takes mail on STDIN, checks it, and then passes it on to your real MTA or exits with an error if there is no attachment and it expects.

Sometimes you may talk about attachments when you don't include any. AttachCheck will stop you in these cases but you'll need to confirm/override it by hand. This can be one in one of two ways:

  1. Adding the word "CONFIRM" in all capital letters in the beginning of the subject line of your outgoing mail. AttachCheck will remove the word when the mail is sent.
  2. Adding a special header that like this: X-AttachCheck-Override: Yes

Enabling AttachCheck in Mutt

AttachCheck was written for and tested with Mutt and it works great under that client. I got AttachCheck working by adding the following two lines to my muttrc file:

set sendmail='~/bin/attachcheck'
macro compose \e0 ':set editor="~/bin/ac_add_override.pl"<enter>e:set editor=vim<enter>'

This will set up the sendmail wrapper so that attachcheck is used and then set up a macro bound to a key (in this case META-0) that will add the override line into your mail with a single keystroke.

You'll of course want to customize these lines to include your editor choice and to include the actual path of attachcheck and the add_override.pl.