blob: c7a728f7bda21acd6474644152e077b2b5899d56 (
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
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/usr/bin/perl
if( -e '/usr/bin/mktemp' ){
$fn = `/usr/bin/mktemp -q /tmp/filtermail.XXXXXXXX`;
}
else{
$fn = `/bin/mktemp -q /tmp/filtermail.XXXXXXXX`;
}
chomp $fn;
$bbsuid = $ARGV[0];
undef @ARGV;
open FH, ">$fn";
$norelay = 0;
while( <> ){
print FH $_;
# if( ($bbsuid) = $_ =~ /for \<(\w+)\.bbs\@ptt/ ){
# }
if( /^Content-Type:/i ){
$norelay = 1 if( (/multipart/i && !/report/i) || /html/ );
last;
}
}
while( <> ){
print FH $_;
}
close FH;
if( !$norelay ){
open FH, "<$fn";
open OUT, "|/home/bbs/bin/realbbsmail $bbsuid";
while( <FH> ){
print OUT $_;
}
close FH;
close OUT;
unlink $fn;
}
else{
$to = substr($fn, rindex($fn, '/') + 1);
#`/bin/mv $fn /tmp/norelay/$to`;
unlink $fn;
}
|