[Mimedefang] Idea: using action_replace_wiht_url for file transfer

JOna jblistat at sll.fi
Thu Jan 15 01:35:43 EST 2004


Hi,
   We often need to transfer large files to people who's mailbox-quota is 
limited. For regular transfers I have made ftp-accounts, but that is not 
allways an option: many people just WANT to use email for file transfer, and 
there's no point in creating temporary ftp-account for a every single file 
transfer (and then having to teach on phone to someone in the other side of 
the country how to install and use the ftp-client programm).

So I've come to think a new idea: whyt not use MIMEDefang's 
action_replace_wiht_url to create a email + web-based file transfer system 
that works with commands on Subject-line. Something like this:

Create mimedefang-filter that checks for a "magic word" in Subject-line and 
when it is found, does the following: 

1) Create a hash of the first attachement (or all the attachements)
2) Create a web-accessible directory named with this hash. 
3) Copy all the attachements to this directory, preserving the original 
filenames (This is important!)
4) Replace attachements with url http://webserver.com/hash/ 
5) Remove "magic word" from the Subject-line

Example: 

I want to send a 30MB file to jsmith at company.com, whose mailbox is only 2MB. 
Now I send the file as attachement, if I add [magic] to Subject line: 
       Subject: [magic] Here's the project data

John Smith then receives a (tiny) message 
       From: me at company.com
       Subject: Here's the project data 
       Message: 
       
       Hi, 

       you will find the files from the following address: 
       http://webserver.com/dh34hs45fbikjomeociw/


But how to do this? I have tested only the "standard" filter that measures the 
size of the attachement: 

#  Save HUGE attachements to webserver
   $size = (stat($entity->bodyhandle->path))[7];
      if ($size > 1000000) {
         return action_replace_with_url($entity,
         "/var/www/webserver.com/attachements",
         "http://webserver.com/attachements",
         "message...\n" .
         "_URL_\n\n");
      }

With my limited programming skills I can't modify the script myself, so I just 
throw the idea here and hope that someone grabs it :-)

JOna



More information about the MIMEDefang mailing list