summaryrefslogtreecommitdiffstats
path: root/util/filtermail.pl
blob: ad349b1ceb5904f6c9088c41b5c8e7a8dd73cd5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl
# $Id$
$SaveNoRelay = 0;

$bbsuid = $ARGV[0];
undef @ARGV;

$msg = '';
$norelay = 0;

while( <> ){
    $msg .= $_;

    $norelay = 1
    if( (/^Content-Type:/i && 
         ((/multipart/i && !/report/i) || /html/)) ||
        /Content-Type: audio\/x-wav; name=\".*.exe\"/ );
}

if( $norelay ){
    if( $SaveNoRelay ){
    $fn = `/usr/bin/mktemp -q /tmp/norelay.XXXXXXXX`;
    open FH, ">$fn";
    print FH $msg;
    close FH;
    }
}
else{
    open OUT, "|/home/bbs/bin/realbbsmail $bbsuid";
    print OUT $msg;
    close OUT;
}