[Mimedefang] action_replace_with_url
    Kevin A. McGrail 
    kmcgrail at pccc.com
       
    Fri Mar  4 08:54:23 EST 2005
    
    
  
Bart,
Assuming the problem might be with your filesize code, I've had good luck
with this routine:
      my($sizelimit, $bh, $path);
      $sizelimit = 1048576; #1MB #max size of an email you want to check in
bytes
      $bh = $entity->bodyhandle();
      if (defined($bh)) {
        $path = $bh->path();
      }
      if (defined($path)) {
        if (-s $path <= $sizelimit) {
        }
      }
Regards,
KAM
> This is what I got in my mimedefang-filter
> I set $size > 100 for testing
> No errors no link
> What do I have to add to make it work
>
>          $size = (stat($entity->bodyhandle->path))[7];
>          if ($size > 1000) {
>         return action_replace_with_url($entity,
>         "/home/www",
>         "http://www.example.com/",
>         "The attachment $fname was larger than 10,000,000 bytes.\n" .
>         "It was removed, but may be accessed at this URL:\n\n" .
>         "\t_URL_\n");
> }
    
    
More information about the MIMEDefang
mailing list