How can I automatically edit an email before auto-forwarding it?

Is there a way to automatically edit emails before forwarding them?

I'm getting email notifications from Foursquare that I want to send to my phone as text messages. I know how to send messages to my number using an email address (I'm in the US and use Verizon) but I don't know how to strip out any unnecessary formatting, like HTML, before the email gets sent.

What I want:

  • Ability to strip out HTML
  • Ability to start forwarding at a specific part of the email based on a search (e.g., I might know that Foursquare starts their messages with "Hey hey!" and only want content after that phrase occurs)
  • Ability to truncate at 160 characters

Things I've tried:

  • I'm not using Foursquare DM pings through Twitter because I have two Twitter accounts and Twitter only allows a phone to be linked to one account at a time. I'm not willing to change which account it's linked to.
  • I tried to work around the Twitter limitation using Google Voice, but they don't support SMS short codes.

I'll compromise on the features I want if I can find a free solution that doesn't require me to set up my own server. I do think this is computer related because it will happen on my computer, not on my phone.

edit My current setup: Gmail in Firefox 3.0.15 on Windows XP. I use a netbook as my only personal computer. However, if the only way to accomplish this well is to set up my own mail server or something, I would still want to know that.


I don't think it's possible from within gmail itself. You'd need a client that's online all the time or your own mail server. It is possible, but it will take some effort.

For example, my always-on desktop grabs my gmail email via fetchmail, and it gets processed by procmail. The "formail" program (part of procmail) can do lots of stuff on its own (inserting/removing headers, etc.). You can filter your mail through custom scripts to massage your email any way you want and then forward it onto another email address.

My desktop is FreeBSD, and I'm uncertain of the best tools to accomplish this sort of task under Windows.