Navigation Menu
loading content ...
Error Message
Macro 'toolbar' not defined, or not allowed to call [restricted_mode=False]
Rated /5.00 | Created 18 November 2009
I've been prodded recently by Ben Gillies who was interested in using my Getmail plugin for generating tiddlers from email. The code I wrote for this was very proof of concept and not really that reusable as far as allowing someone to take the plugin and seamlessly add it to their TiddlyWeb. It was more of a 'this is how you could do it please take my code and improve it'.

So I thought I'd revisit it and package it up into something more friendly. The latest version defines a base class called InboxParser which itself can be found in inboxparser.py. The twanager command itself is implemented in getmail.py. As before it is called getmail and takes 1 parameter (the bag name where
the tiddlers should be saved to). The default behaviour of this command is that it will go to the e-mail inbox defined in your config file (see README.txt for details) and will retrieve all messages in the inbox. By default emails are converted to tiddlers where the email subject becomes the e-mail title, the text of the email becomes the tiddler text and the modifier/creator of that tiddler is the
originating e-mail address. If a tiddler already exists with the given title it appends a number to the end. eg. if tiddlers with titles "Title" and "Title 0" and "Title 1" exist and I send an e-mail with subject title it will be saved to "Title 2". The email is then deleted from the inbox so it is not generated again.

Obviously these defaults do not suit anyone. I have had various conversations with Jeremy Ruston, Michael Mahemoff and Ben about this and we have established that maybe the e-mail address you use generates tags. For example if I send a mail to photo+awesome+jon@jonrobson.me.uk maybe a tiddler is created tagged with photo, awesome and jon. Also I could dream up a system where when I send an e-mail with subject "This is my e-mail #photo #awesome #jon" the tiddler "This is my e-mail" is created with
tags photo, awesome and jon.

I've thus established in all of this that I can't predict how people might use this, so for the time being I suggest people extend my InboxParser class to achieve their own use cases. If you look at the file getmail_flavours.py in the repository you will see the hash tag example implemented. Here you create a new twanager command called "getmail_hashtags" which uses a new class HashTagInboxParser which
overrides the process_email function of the class defined in getmail.py. I'm not sure this is the best solution, but at least it offers a way to use it for the time being.

Now all I need to do it sort out the sending functions. Let me know your thoughts on this implementation below.

Thanks for reading this far. Did I bore you or interest you? Let me get better at doing the latter and focus more on working on the good stuff...
Error Message
Macro 'ratemytiddler' not defined, or not allowed to call [restricted_mode=False]
Comments
Error Message
Macro 'tiddlyWebComments' not defined, or not allowed to call [restricted_mode=False]
a list of older blog posts can be found at here

Please ignore the following if you are using a text browser (this is part of the TiddlyWiki application used to run this software):