mailserver which inserts mails to tiddlywikiDB

24 views
Skip to first unread message

geert geurts

unread,
Jun 18, 2012, 9:38:11 AM6/18/12
to ccti...@googlegroups.com
Hello all,

I was missing a feature to cctiddlywiki to easily insert content to my cctiddlywiki using my phone so I created a solution in which people might be interested...
It's a python script which functions like a mailserver(listens to port 25) it currently has the following features:
* checks if the peer of the connection is in the currently active range of googles ip range. (useful for me because I use gmail... needs to be modified if you're not using gmail)
* checks the from address (in my case it only accepts mail from me)
* extract the workspace from the address (in my case this is WORKSPA...@wiki.verweggistan.eu)
* inserts the plain text body of the mail into the content field of a tiddler.
* accepts and stores attachments in a subfolder of cctiddlywiki documentroot named mimetype of attachment/date
* inserts a link to the attachment in the tiddler
* check size of image and insert a [img[/location/of/image.jpg]] line if image is smaller then 700x700 (doesn't work completely... not sure why...)
* /etc/init.d/ script to start the server included

This code is quite beta if not alpha... I'm not a programmer so the code is probably going to appear hideous to a decent programmer but it works...
If anyone wishes to test/improve it there are some dependencies you'll have to take care of:
* python-PIL
* python iptools (http://code.google.com/p/python-iptools/)
* dig (just the command line tool, is used to get the currently active ip range of google servers)
 
Then you can download the code from: http://verweggistan.eu/wikimailserver.zip
* put the wikimailserver script in /etc/init.d and run  update-rc.d to activate the service in the desired runlevels.
* modify the init.d/wikimailserver script to call the correct wikimailserver.py script for me this is /usr/local/bin/wikimailserver.py
* modify some settings in the wikimailserver.py script. (DOCROOT,VALIDSENDER, RECEIVER... the capitalized variables after the imports, and maybe some other stuff... You'll have to debug a bit... I told you it's beta if not alpha ;)
* and of course modify your firewall to allow connections to port 25.

I hope this is going to be interesting to some people and I hope people will find the time to improve/clean it up a little.

If you have any questions/comments you can always contact me geert ( at ) verweggistan.eu, and please let me know when you're using it :)


Best regards,
Geert
Reply all
Reply to author
Forward
0 new messages