imh

File List
Login

Files of check-in [5b2bc8a217] in the top-level directory


Disclaimer:

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:

https://github.com/vandys/chore

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

python-html2text
python-ipaddr
python-sendfile

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


~/.imh.config

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

name "Joe User"
service "mh imap"
server imap.server.com
user myusername
password mysecret
mailboxes myname@* anothername-*@olddomain.com ...
address myacct@mydomain.com

~/.imh.state

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.)


~/.imh.abook

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 <john1@nosuchdomain.net>
1 Jimmy John <jimmy@wildwestlossage.org>
Which: (you type)0
[To: John Jones <john1@nosuchdomain.net>]
To: (you type)cc Sam
[To: John Jones <john1@nosuchdomain.net>]
[Cc: Sam Bigname <sammyboy@bigdomains.xyz>]
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 " 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 nameemail@address.com". 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 mymailserver.com

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!


TBD

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 http://vsta.org/contact/andy.html