デフォルトでは
use_article_filter_reject_notice = yes article_filter_reject_notice_recipient = maintainer senderとなっています。 つまり、エラーメールを返し、返す先はMLの管理者と送信者の両方です。
返送する先を送信者( From: のアドレス )にするには
article_filter_reject_notice_recipient = senderとしてください。
MLの管理者と送信者( From: のアドレス )の両方に返すには
article_filter_reject_notice_recipient = maintainer senderとしてください。
そもそもエラーメールを返さないようにするには、
use_article_filter_reject_notice = noとしてください。
Caution |
そもそも spamassassin をよびだす内蔵フィルタがあるのですが、 それをあえて使わない例です。 |
HOOK でなんとかする/ごまかす例。
$distribute_verify_request_end_hook = q{ my $spamassassin = '/usr/pkg/bin/spamc -c'; use FileHandle; my $wh = new FileHandle "| $spamassassin"; if (defined $wh) { $wh->autoflush(1); my $msg = $curproc->incoming_message(); $msg->print($wh); $wh->close(); if ($?) { $curproc->log("spam: (code = $?)"); $curproc->stop_this_process(); } } };
$distribute_verify_request_end_hook = q{ my $spamassassin = '/usr/pkg/bin/spamc -c'; use FileHandle; my $wh = new FileHandle "| $spamassassin"; if (defined $wh) { $wh->autoflush(1); my $msg = $curproc->incoming_message(); $msg->print($wh); $wh->close(); if ($?) { $curproc->log("spam: (code = $?)"); my $hdr = $curproc->incoming_message_header(); $hdr->add('X-Spam-Status', 'Yes'); } } };
ちょっとトリッキーですが、動きます。
fml8 は、あらかじめ入力されたメッセージを解析し、鎖状の Mail::Message オブジェクトの形で持っています。そこで、MIME/Multipart の各部分のヘッ ダを取り出して、正規表現で順に確認すればよいだけです。
HOOK でなんとかする/ごまかす例は次の通りです。 どちらの例でも、マッチした場合、stop_this_process() 命令で、 これ以上の処理を止めています。 また、この例では何もエラーメッセージを返そうとしていないため、 結果として、このメッセージは無視されて終りになっています。
返事をしてあげたいなら、 reply_message() で、何か返事を返してあげてく ださい…が、たぶんウィルスとかなので、返事してあげなくてもいいとおもふ。
.exe など特定のファイル拡張子にマッチするか?を調べる例。 に昔の fml8 (2004/12/08 以前)なら、こんな感じ。
$distribute_verify_request_start_hook = q{ my $msg = $curproc->incoming_message() || undef; for (my $m = $msg; $m ; $m = $m->{ next } ) { my $hs = $m->message_fields() || ''; if ($hs =~ /filename=.*\.(com|vbs|vbe|wsh|wse|js|exe|doc|rtf)/o) { $curproc->log("attachment \.$1 found"); $curproc->stop_this_process(); } } };2004/12/08 以降なら、こんなかんじ。
$distribute_verify_request_start_hook = q{ my $msg = $curproc->incoming_message() || undef; my $list = $msg->message_chain_as_array_ref(); for my $m (@$list) { my $hs = $m->message_fields() || ''; if ($hs =~ /filename=.*\.(com|vbs|vbe|wsh|wse|js|exe|doc|rtf)/o) { $curproc->log("[new] attachment \.$1 found"); $curproc->stop_this_process(); } } };
別の解としては、
Content-Disposition: attachment;という表示になることを前提に、これを引っかけるという案もあります。
$distribute_verify_request_start_hook = q{ my $msg = $curproc->incoming_message() || undef; for (my $m = $msg; $m ; $m = $m->{ next } ) { my $hs = $m->message_fields() || ''; if ($hs =~ /Content-Disposition:.*attachment;/o) { $curproc->log("attachment \.$1 found"); $curproc->stop_this_process(); } } };2004/12/08 以降なら、こんなかんじ。
$distribute_verify_request_start_hook = q{ my $msg = $curproc->incoming_message() || undef; my $list = $msg->message_chain_as_array_ref(); for my $m (@$list) { my $hs = $m->message_fields() || ''; if ($hs =~ /Content-Disposition:.*attachment;/o) { $curproc->log("[new] attachment \.$1 found"); $curproc->stop_this_process(); } } };
author's homepage is www.fml.org/home/fukachan/.
Also, visit nuinui's world :) at www.nuinui.net.
For questions about FML, e-mail <fml-bugs@fml.org>.