in Tools

send news alerts to your cell phone with procmail and awk has a News Alerts mailing list where you can subscribe to get breaking news delivered to your e-mail inbox. Unfortunately, the news alert e-mail has a lot of extra gunge before and after the body of the actual alert, in our case, a header saying “Breaking news from CBC” and then some trailing text about how to unsubscribe from our mailing lists, etc. I use this procmail recipe to strip out the extra stuff and just send the body of the message to my cell phone. You might find it useful too!

[email protected]

:0 c
* ^From:.*[email protected]
  :0 fbw
  | awk 'BEGIN { state = 0 } /^_____/ || /^Visit/ { state++ } state==1 && !/^_____/ && length()!=0 { print }'

  :0 fwa
  | formail -I "From: [email protected]" -I "To: $TARGET" -I "Subject:"


There are still a few problems with this recipe: namely, the alert body is now being indented a few characters on each line, so there needs to be some s/^ +//g whitespace-stripping logic added to the recipe. Also, the recipe doesn’t strip leading or trailing blank lines very well. I welcome your contributions to fix this.

I’m also aware (since I work on the Operations team) that there are problems with the performance of the mailing list subscription and unsubscription interface. We have used GNU Mailman for many years as the list-management software but we have outgrown it, and there is high contention on the Pickle database files containing each list’s subscribers. We’re currently trying to replace the system entirely, but because we still need to maintain backwards compatability with MyCBC by having an XML-RPC interface to manage subscribers, the task is non-trivial and almost certainly requires some custom code.

As with most things, fixing the problems will depend on more time and more money!

Write a Comment