Top-level Files of tip

Files in the top-level directory from the latest check-in


You are getting this for free. I make no guarantees. Back up your data, use at your own risk. I've done my best to code this carefully, and I do use it myself. But please understand that something could happen and it might delete or corrupt your email, or send something unexpected out. If you want guarantees, I'm not sure what email package you should use--but not this one.

This is a kinda-sorta clone of the old mh/nmh CLI email system. It provides:

comp, folder, folders, inc, next, pick, refile, repl, 
rmm, scan, show, whatnow

(Probably others by the time you read this.)

Their operation should be mostly unsurprising to anybody who has used mh/nmh in the past.

However, this suite is built from scratch, coded in Python. It is also built to operate off an imap server, rather than local files and mbox storage. "inc", for instance, will just list new messages in your inbox on your imap server; there's no stage where you pull your email into your Mail directory.

The source directory has a bin/ subdirectory with symlinks from the simple command name to the Python script. If you put the path to that bin/ subdir in your PATH, you'll have the commands available.

It leverages some other code, which you should check out right in the source directory:

You'll also need some standard Python modules; here are the package names on Debian:


There are also a couple local files involved in imh's operation:


This file holds your imap and email profile, it should have the following lines (with no leading spaces):

name "Joe User"
service "mh imap"
user myusername
password mysecret
mailboxes myname@* anothername-* ...


The config will be compiled into JSON and stored here. This JSON state also keeps your current folder, and your current message number in each folder. (The dynamic state might end up stashed in a special imap folder, so it's common across multiple hosts. We'll see.) If you change your config, blow this away. (TBD, check time stamps, etc.)


This is not really an address book, but a tabulation to help with email completion. Unlike classic mh, when you do "comp" there's an initial query:

myhost$ comp
To: (you type)Joe
Nothing matches 'Joe'
To: (you type)John
0 John Jones <>
1 Jimmy John <>
Which: (you type)0
[To: John Jones <>]
To: (you type)cc Sam
[To: John Jones <>]
[Cc: Sam Bigname <>]
To: (you hit enter)

and now you go into your $EDITOR with the usual type of composed email format. It's a way streamline the very common need to pull in someone's address. "cc <string>" does the same match, but adds it to the Cc list instead of the To list. If there's just one match, it's used. If there's multiple, you get a list.

The contents of ~/.imh.abook is lines, "Human name<tab>". You can certainly edit it directly. But the command "abook" operates with the same arguments as "scan", and pulls in each From: address and adds it (if it isnt' already there). So "abook +inbox" would glean all new addresses from messages in your inbox. After that they'd be findable for completions.

Sending email

whatnow sends by connecting to localhost:25. I use ssh port forwarding to get from my mail host to my email server:

sudo ssh -C -L 25:localhost:25 -N

I need to be root on the local machine (to listen on port 25), but I don't need to be root on the mail server (it connects to 25, but can use any unprivileged port). Because this lets me submit email as a localhost on the mail server, there's no problems with email relay security rules. And it's over ssh, so you get the usual encryption and authentication.

SMTP over SSL, SMTP authentication, other techniques? TBD. Feel free to send me a pull request!


I'd like to add some more MIME attachment support, both viewing attachments and generating attachments onto composed messages. For now I cut over to Squirrelmail when needed, a benefit of being imap based.

I hope you find this useful, or at least have some fun hacking on a human scale email program.

Andy Valencia