[Mimedefang] Howto use mimidefang _only_ for replacing attachments with urls?

Tony K Lindstrom tli at tekla.com
Wed Mar 14 05:26:01 EST 2007


I am new to mimidefang, but I haven't found anything in the faq, howto
or any other docs that clearly explain what is needed to use mimedefang
to only move the attachment to a spool-directory and replace it with a
url in the mail.

I thought it was as simple as removing all the other filters from
mimedefang-filter and add the routine to do what I want. I am not
familiar with perl so there might be something that I don't understand.

Anyway this is what I have now in mimedefang-filter:

# -*- Perl -*-
# mimedefang-filter
#
$AdminAddress = 'postmaster at some.com';
$AdminName = "MIMEDefang Administrator or mailgw";
$DaemonAddress = 'defang at some.com';
$AddWarningsInline = 0;
md_graphdefang_log_enable('mail', 1);
$Stupidity{"NoMultipleInlines"} = 0;
detect_and_load_perl_modules();

sub filter {
$size = (stat($entity->bodyhandle->path))[7];
if ($size > 1000000) {
     return action_replace_with_url($entity,
          "/var/spool/MIMEDefang_Captured_Files",
          "http://snailgw.tekla.com/captured_mailfiles",
	  ($fname? "\"$fname\"" : "Attachment").
            " (".humanize($size).") relocated:\n\n_URL_",
    	 $fname  # extra data to save
  	 );
	}
}
1;

----
But this doesn't seem to work, it says that:


 Can't call method "bodyhandle" on an undefined value
at /etc/mail/mimedefang-filter

So, what am I missing?


-- 
Tony Lindström - System Specialist - RHCE - Tekla Oyj
PL 1, Metsänpojankuja 1 - 02130  Espoo - Finland
Phone: +358-30-6611 441 GSM: +358-40-7620 768
http://www.tekla.com/




More information about the MIMEDefang mailing list