[Mimedefang] Idea: using action_replace_wiht_url for file transfer

JOna jblistat at sll.fi
Thu Jan 15 11:26:28 EST 2004


Andrew J Caird kirjoitti:
> JOna,
>   The Mimedefang HowTo has an example of almost exactly this.  

Not exactly. Like I wrote in my message that's the example that I've been 
using. My idea _starts_ from there. Additional scripts are needed for the 
following: 

* How to do action_replace_with_url when there is a "magic word" in 
Subject-line? (and not when the attachemenet is bigger than something)

* How to create a hash-named directory instead of changing attachement names? 
(Attachement names can have important information that is lost if the 
attachement names are changed. That's why I can not use the example script at 
all in production environment.)

* How to (in a given condition) action_replace_with_url ALL attachements 
instead of just the big ones? 

* How to remove some known part (magic word) from Subject-line

JOna

On Thu, 15 Jan 2004, JOna wrote:
> 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.
>
> So I've come to think a new idea: whyt not use MIMEDefang's
> action_replace_with_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:
>
> When I want to send a 30MB file to jsmith at company.com, whose mailbox 
> is only 2MB 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 and used the example 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