Fun with Unix
So. I learned a little bit about a lot of things last night. I wanted to share because I found some cool resources. Warning: technical discussion follows.
Some facts: I play WoW
. I'm in a WoW guild blog
. We also have a Yahoo! group page
. I wanted everyone in the guild to get emailed whenever anyone commented on the blog. We use blogger and it doesn't have very much in the way of group blog features. Because yahoo groups is a glorified listserv, I wanted to post comments to our blog to the group page and let yahoo email the comment to the group. Posts to the group page get sent to the group members (i.e. my fellow guildies).
Blogger developers, if your listening, a very nice feature: email comments to all blog authors.
Anyway, I ran into some troubles
Grabbing for straws here...Brian
Is there a way to force gmail to convert html emails to plain text before forwarding (via a filter)?
I'm kludging together a feature that blogger should have... When someone posts a comment to my group blog, I'd like the whole group to receive an email. Blogger won't do this (mostly because it doesn't store member email addresses). My group also has a "yahoo group" which I use as a mailing list. Yahoo groups only supports email posts from registered users. Needless to say, I can't figure out a way to tell
yahoo groups to accept emails from blogger (noreply-comm...@blogger.com).
So... I'd like to setup blogger to send my gmail account (which is registered with yahoo groups) the email. I'd use gmail's filter feature to redirect the blogger comment to yahoo groups. *pant, pant*
The twist: blogger sends comments as HTML, but Yahoo groups won't accept HTML formated email submissions! Arg!
Thus, can I get gmail to convert the html emails to plain text before forwarding on to yahoo groups.
(BTW, if you have a better solution to my problem, I'm all ears.)
gave me some hints, but gmail turned out to be a dead end.
I sucked in my gut, pulled up my britches and headed over to he.net, where my website is hosted, to delve into the mysterious world of Unix mail. I knew it must be possible to write a script to redirect email. Mailbots, as they're called. Some googling later, I discovered a UNIX utilities called procmail...
(That elipsis represents about 5 hours of messing with the procmailrc file. See these comments.
This is the .procmailrc file I created.
| formail -rk -I "Content-Type: text/plain; charset=UTF-8"
| sed 's/<[^>]*href="\([^ "]*\)"[^>]*>/- \1 -/g'
| sed "s/<[^>]*>//g"
| $SENDMAIL -oi email@example.com
Basically, this is a script that preprocesses email as they come into the server. My script matches emails that come from blogger, it changes the content type email header, strips the html tags (keeping URLs) and then forwards the email on to the yahoo group page. The goobly gook you see are regular expressions. If you don't know regular expressions, run to your nearest google search box and look it up. They're essential.
I edited the page in emacs. Here's an emacs cheatsheet
that I found because its been years since I used the program.
Also, a shout out to he.net... They rock. If you need web hosting, use hurricane electric
UPDATE: It doesn't appear to working now! Arg! Back to the UNIX labyrinth...
UPDATE 2: It works now.