How do I create a Thunderbird message filter for an attachment type?

October 12th, 2007

I want to create a rule in Thunderbird that forwards every email I recieve that has an .ics attachment (aka meeting requests) to an abitrary address.

And I can’t figure out how to do it.

Help me Lazy Web! You’re my only hope.

5 responses to “How do I create a Thunderbird message filter for an attachment type?”

  1. You could try filtering on the mime type declaration – e.g. body contains

    Content-type: text/calendar

    That’s about the only thing I can think of that might work.

  2. Hrm, I don’t suppose they’re all sent with the right content-type? It’s a little ugly, but a filter on “body contains” does get to look at all of a multipart/mixed body, so a filter looking for “Content-Type: text/calendar” ought to find them (well, and the notification mail from this comment, but I like to make the Lazy in Lazy Web refer to me, not just to you).

  3. I didn’t claim it was perfect, but there don’t seem to be any selectors available for content-disposition filenames (which also have no guarantee of what type of data they might contain).

    But on closer examination, I notice that the recent Thunderbird filters don’t even have a selector for body contents. So I don’t see an easy way out of this at all. You can still create a ‘view’ with body contents, but not a filter. Looks like filters now can only examine SMTP headers – and there’s nothing in the headers to indicate anything about potential MIME leaf nodes. Yuk.

    This is probably best done as a server-side process, ala procmail although I personally hate procmail going back 15-20 years and wouldn’t wish that on anybody. One could also use a scripting language like php or perl or whatever with an IMAP extension and be able to examine things in the attachment structure and grab the content-disposition filename; compare with *.ics and also look at the content-type to be sure it wasn’t a Swiftview Image command Set file or some other .ics entity. This could possibly achieve the desired result.

    But it certainly isn’t lazy.

    There’s one other possibility – which would be a thunderbird plugin. I know they finally have a reasonably stable calendar plugin (it only took ten years). Might be able to grab the .xpi source for that or some other attachment handler and tweak it to output/copy the file. I haven’t actually done one of these plugins myself so I don’t know how hard it might be.

  4. kellan says:

    Thanks guys!

    I was feeling dumb for not being able to find a feature I knew had to be there. Comforted that smarter people then I came to similar conclusions.

    And yeah, digging into the Lightning codebase to build my own simplified version might be the way to go.

  5. Edward says:

    If you have found a solution to the atttachements problem please send me a copy , I want to capture *.txt files from just one source and save them to a hard disk ( not mail) folder and then be able to read the text thank you