mutt, procmail, and the apple address book

rjbs on 2007-03-07T04:38:30

It seems like everyone I know is using Thunderbird or Apple Mail, these days. Sometimes, I feel a little left behind. I still run mutt. Then again, every time I try to use a GUI mail application, I feel stifled. It just isn't smart enough.

Still, it's really nice to put things in one place and have them show up everywhere you need them. Apple Mail's integration with Address Book is nice -- although really, I just want it to look up email addresses for me. The whole iChat integration I can live without.

A few years ago I wrote a script that would dump my Address Book into a file containing mutt alias entries to be sourced into my muttrc, and that got me a good bit of what I wanted.

Meanwhile, I also use procmail to sort my mail. Sure, I should use Email::Filter or something, but I've got a lot of intertia and a lot of built-up rules. I've been getting annoyed that my friends.rc, which sorts mail from friends and family into folders, has grown out of date, and I kept wanting to tie it to Address Book.

Today, I rewrote my abook script to do that, and to be more generally extensible and awesome as time goes on. (I also ended up reorganizing a lot of my mail-config files and writing a Makefile. I feel exceptionally nerdy.)

I will eventually release abook as a dist on the CPAN, but even now it's pretty useful. It can dump two files: one is a set of procmail recipes, the other a set of mutt config lines. Right now, it just helps sort mail, creates aliases, and can enable custom signatures. In the future, I'll probably also have it dump SpamAssassin whitelists, make use of Address Book groups, and maybe even update Pobox whitelists.

I also updated my mutt configuration to better cope with some OS X stupidity. OS X's DHCP client doesn't seem to have a "do not change my hostname" option. I had some mutt configuration loaded conditionally based on current hostname, which broke when I'd get on the office or cellular network. Now I've updated it to check things like the ethernet address of the current computer. I added offlineimap configuration for my work IMAP account, and hopefully tomorrow I'll make it easy to access both personal and work email from one mutt instance no matter where I am, with the same folder names and key bindings.

Of course, whatever procmail-replacing script I write will have to have pieces built by abook! I'm not sure if anyone else out there is using this set of tools: mutt, procmail, and Apple Address book. If so, maybe abook will be useful for you, too.


How aren't GUI mail apps smart enough?

mdiep on 2007-03-07T06:05:12

Then again, every time I try to use a GUI mail application, I feel stifled. It just isn't smart enough.
Could you elaborate on this? I've heard people say things like this in the past, but I've never used a command-line mail client, so I don't know what they're trying to do.

Re:How aren't GUI mail apps smart enough?

parv on 2007-03-08T06:59:19

Currenlty I am using Thunderbird on MS Windows (for work, need to use IE), with an IMAP account; haven't tried Agent yet. Otherwise, I /much/ prefer to use mutt. Most of the problems listed below (of Thunderbird) are due to intrinsic differences (inherent features) rather than due to GUI|CLI differences, I think.

  1. (GUI Problem) There is no way to fix sort options. At least once a day, I occasionally hit some column label in message index while selecting a message to read, resulting in re-selection of the sort options.
  2. Search function works sometimes. When it does, it does not support regular expressions.
  3. In Thunderbird, there is no option to set view particular headers, unlike mutt. It is all or nothing option.
  4. Control over editing a (received) message (header or contents) is lousy. Actually, so far I have not seen anyway to edit headers of OP in Thunderbird.
    • Thanks to cygwin that I can use mutt to edit headers to rethread messages mainly due to brokeness of headers in replies of others.
    • My boss has very bad attitude (rather, bad kind of laziness) toward composing a new mail. He composes a new message as a reply to the first message (I guess) he sees from me, without editing the quoted text or subject (let alone remove In-Reply-To: or Refereneces: headers) which never ever has to do what he has written. So to make sense of his emails, overall, I have to edit them heavily.
  5. Even when all the possible options have been set for plain text and non-flowed format, copy-paste of the text after clicking "Reply" results in blank lines (not visible in reply window) & end spaces (possibly presnet in OP). Perhaps I may have missed something? I would be happy if g?Vim could be hooked in Thunderbird; so that writing a new mail invokes it, and more importantly replying (happens more often) to a message sends text it.
  6. Yesterday, go-to-next-message key binding (F) was not working, when there were no new messages. I made sure that 'F' was not mapped to go-to-next-unread-message.

But wait, there /are/ some things I like over mutt...

  1. When attachments are "Detached" (saved on local fs, contents removed from email), Thunderbird maintains the link to the file on fs. I would like a way to be able to re-link attachments after directory (local fs) has been renamed.
  2. IMAP folder indexing|caching seems to have better performance (compared to mutt built w/ header-cache patch & imap cache option set).

Re:How aren't GUI mail apps smart enough?

rjbs on 2007-03-19T16:04:39

More than you wanted to know: http://use.perl.org/user/rjbs/journal/32742

Keep OS X hostname from changing

tagg on 2007-03-07T09:18:01

To keep the hostname from changing, edit /etc/hostconfig, and set HOSTNAME="MyHostName".

Hope that helps.

Re:Keep OS X hostname from changing

rjbs on 2007-03-19T16:05:10

Awesome, thanks!