$HOME/.mailfilter
==============================================================
if ((/^Subject:.*/))
{
`mime_header_decode Subject "$MATCH" | egrep "测试" >/dev/null 2>&1`
if ( $RETURNCODE == 0 )
{
to "$HOME/Maildir/.Sent/."
}
}
==============================================================
其中mime_header_decode程序的代码:
==============================================================
#!/usr/bin/perl -w
##########################
## MIME decode by ELM
##
## http://wenzk.cublog.cn
## 2006/03/15
##
## Usage: mime_header_decode
##
use MIME::Head;
(my $progname = $0) =~ s|.*/||;
sub usage
{
print STDERR "\nUsage: $progname HeaderName Strings
HeaderName Mime header name (eg: From To Subject ...)
Strings Strings to decode
";
exit (1);
}
usage () unless @ARGV;
$head = MIME::Head->new;
$head->replace("$ARGV[0]", "$ARGV[1]");
$head->decode;
print $head->get("$ARGV[0]", 0);
=================================================================
参考代码(maildropex手册):
=================================================================
cc $DEFAULT
xfilter "reformail -r -t"
/^To:.*/
getaddr($MATCH) =~ /^.*/;
MATCH=tolower($MATCH)
flock "vacation.lock" {
`fgrep -iqx "$MATCH" vacation.lst 2>/dev/null || { \
echo "$MATCH" >>vacation.lst ; \
exit 1 ; \
} `
}
if ( $RETURNCODE == 0 )
exit
to "| ( cat - ; echo ''; cat vacation.msg) | $SENDMAIL"
阅读(6704) | 评论(0) | 转发(0) |