[Mimedefang] filter multimedia files and replace with url

Yizhar Hurwitz yizhar at mail.com
Wed Oct 5 17:13:56 EDT 2005


I am managing a mail server with MimeDefang version 2.52
(Fedora Core 3 + Sendmail + Mimedefang + SpamAssasin + Clamav + Cyrus IMAP)

I'm currently using replace_with_url for files bigger then 8mb in the production server,
and now I would like in addition to do it also by extension with some multimedia files.

I have written the code to do it, implemented in a test machine similar to the production.
It seems to work fine and do the job as expected.
However, I have no experience with Perl, so I would like you to take a look at the code,
and just tell me if it is OK or if you have any comments about it.

Here it is (copied from the test machine):


 $multimedia = '(avi|mpg|mov|pps|wmv)';
 if (re_match($entity, '\.' . $multimedia)) {
      return action_replace_with_url($entity,
      "multimedia file converted to URL:\n_URL_\n");


The code is in the "filter" subroutine.
Is that correct?
Should it also be in filter_multipart?

Additional notes:

In the production server I will use a more descriptive text to the users, no need to comment about this.

In the production server I will use a real FQDN of course instead of so you don't have to comment about 
this, and also a different path instead of "/var/tmp/mail_parts".

I'm not interested in multimeda files inside ZIP - only regular file attachments.

Thanks for any comments.
Yizhar Hurwitz

More information about the MIMEDefang mailing list