procmail

Does anybody still uses Procmail?

Because I do feel like I’m the last one. Like the last Samurai or something like that. Of course I’m talking about desktop users not on servers (where it’s probably still relatively widespread).

The other day I was pondering that I hadn’t touched my mail delivering set up for years since I started using the combination of fetchmail + procmail for pop fetching, mutt as MUA and postfix as smtp server. I’m talking of around 9-10 years at least. I only added offlineimap to the configuration 4 years ago for syncing gmail mailboxes via imap.

There have been some new software that menaced this set up, like getmail instead of fetchmail, mstmp for simple smtp relying and fdm as a total replacement. None of those really moved me into changing my set up. Getmail is mostly equivalent to fetchmail while mstmp simply sends the outbound mails to a smtp server of choice, much like what I have configured postfix to do as I am on a dial-up connection and the isp would ban me if I’d use a smtp server without a full qualified hostname.
Yet today I installed fdm and started configuring it but stopped without finishing for two reasons:
1. I don’t receive much pop3 mail anyway. I might simply use mutt to read the new mails once in a while and copy them the hard disk if I wanted to keep them. This way neither fetchmail + procmail nor fdm would be needed at all.
2. I didn’t like to learn a new program, with different regular expression rules (for ’s sake, Regular Expressions!), make it work as procmail has always done and then test it simply to have 1 software instead than 2 (and saving 1,9Mb of space).

Besides, I’ve grown accustomed to procmail syntax, despite its quirkiness, and it may still feel nice to tell people that I have had the guts to configure it. :)

procmailrc

There’s lots rc settings in procmail, recipe format is:

:0 [flags] [ : [locallockfile] ]
<zero or more conditions (one per line)>
<exactly one action line>

Examples are listed:

1. Accept email which prefix starts from alphabets:

:0: $LOCK
* !^From [a-zA-Z][a-zA-Z].*@.*
junk

2. Mail size larger than 256k, put it in another mbox:

:0
* > 256000
larger

3. Accept all (usually put in the bottom of .procmailrc):

:0
${DEFAULT}

4. Mailing list classifier:

:0
* ^Sender:.owner-freebsd-\/[^@]+@FreeBSD.org
{
        LISTNAME=${MATCH}
        :0:
        * LISTNAME??^\/[^@]+
        ${HOME}/Mail/freebsd/freebsd-${MATCH}
}

Rock! :D

6

Lifehack: Google Now (Voice Actions) to Astrid grocery list.

Figured out a process to quickly add items to my grocery list on Astrid using Google Now. That way I can press the microphone button on my phone and quickly set a reminder for later when I’m in the store.

I first tried using an IFTTT recipe to email new tasks to Astrid but regular expressions aren’t supported and there just wasn’t enough control.

The process ended up being a bit convoluted, at least in the background:

  1. When you say “note to self” in the mic it emails your Gmail account.
  2. Gmail filters for those emails and forwards to a procmail server.
  3. Procmail pipes the email to a Python script.
  4. Python extracts the grocery list items and sends a message to new@astrid.com
  5. Astrid interprets the email and creates a task.

Gmail filters and forwards can be setup in your email settings but the procmail and python bits depend on you having a server to run the stuff on and a benevolent sysadmin (thanks, Keenan).

The end result is I can say “note to self we need bacon, lettuce, tomato” and in a moment or two my grocery list on Astrid has bacon, lettuce, and tomato as three new tasks.