[Mimedefang] Replace with URL?

Fernando Gleiser fgleiser at cactus.fi.uba.ar
Tue Jul 27 17:18:48 EDT 2004


One of my customers wants to replace all attachs in internal mail (the
sender and all the recipients are in the local domain) greather than
300k with a link to the internal webserver, in order to save diskspace
in the mail server.

I think I can do that with replace_with_url, I was thinking something
along the lines of:

if ($Sender =~/\@localdomain.com>?$/) {
    $localmail=1;
LOOP:   foreach $rcpt (@recipients) {
        if ($rcpt !~ /\@localdomain.com>?$/) {
            $localmail=0;
            last LOOP;
        }
    }
}

if ($localmail==1) {
    $size = (stat($entity->bodyhandle->path))[7];
    if ($size > 500000) {
        return action_replace_with_url($entity,
            "/usr/local/www/data/mailattachs/",
            "http://www.localdomain.com//mailattachs",
            "Your attach was for internal personnel only".
			"and it was bigger then 500k. To see it,".
			"please click here \n\n\t_URL_\n");
    }
}

So my questions are:

1) does it look good?
2) where should I put it? in filter()? after all the other filtering was
done?
3) is there any other way to do it?

Thanks in advance




				Fer



More information about the MIMEDefang mailing list