exo : code : email_webstorage

A quick and handy script to take emails with attachments and stuff the attachments somewhere a webserver can see them. I wrote it as a quick hack for letting friends share files that they didn't want to email to people in case coroporate firewalls objected. It's not all that well tested so it might well fall over.

It uses a slightly munged sender's email address as the directory to save the files under and automatically stuffs an index.html file in the directory to stop random browsing.

Usage

I use it by piping things to it via procmail.

You'll need to create a config file something like this:

basedir = /path/to/where/you/want/files/stored
webpath = http://example.com/corresponding/uri/base
logconf = /path/to/log4perl/config
from = store@example.com

The file should either be $HOME/.email_webstoragerc, /etc/email_webstoragerc or you can pass the file location using the -conf option.

perldoc email_webstorage.pl should give you full(er) details...

Requirements

It's Perl and it's only tested on 5.8.5 so all bets are off for anything else.

The following perl modules are required:

Although to be fair if you hacked out the relevant bits you could do without last two. Log::Log4perl was mostly used as I wanted to try it out.

Download

email_webstorage.pl

Caveats

It should be obvious to anyone that this is a potential security risk so you shold take sensible precautions with it. I've also no idea how large a file you can throw at it and I imagine that's partly hardware dependant.

It doesn't check if it's going to overwrite files 'cause hey, if you want to store stuff reliably then this isn't a good solution ;)

Did I also mention it's probably not that robust and if the mail client doing the sending does attachments in a weird way then it won't work. It does seem to work with mails from Outlook though so that's at least the most popular evil mail client handled ;)

all the usual copyright stuff... [ copyright struan donald 2002 - present ], plus license