diff options
| author | fukachan <fukachan> | 2001-04-12 04:43:05 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-04-12 04:43:05 +0000 |
| commit | 24ddffe87ee79f37f15125c0c899b221b795582e (patch) | |
| tree | 6a798a1df75e4ada824e38f4c807ab5f772e330d | |
| parent | 321c99834aa544781158dc4297e43e3bafa336da (diff) | |
| download | fml8-24ddffe87ee79f37f15125c0c899b221b795582e.tar.gz fml8-24ddffe87ee79f37f15125c0c899b221b795582e.tar.bz2 fml8-24ddffe87ee79f37f15125c0c899b221b795582e.zip | |
enable to parse nifty.ne.jp error pattern
| -rw-r--r-- | fml/lib/Mail/Bounce/SimpleMatch.pm | 60 | ||||
| -rw-r--r-- | regress/testmails/error=nifty.ne.jp | 37 |
2 files changed, 88 insertions, 9 deletions
diff --git a/fml/lib/Mail/Bounce/SimpleMatch.pm b/fml/lib/Mail/Bounce/SimpleMatch.pm index c9306562..244ca5f6 100644 --- a/fml/lib/Mail/Bounce/SimpleMatch.pm +++ b/fml/lib/Mail/Bounce/SimpleMatch.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: SimpleMatch.pm,v 1.3 2001/04/11 16:59:53 fukachan Exp $ +# $FML: SimpleMatch.pm,v 1.4 2001/04/12 03:30:30 fukachan Exp $ # @@ -44,20 +44,31 @@ When we trap C<end>, the state changes from l to 0. my $debug = $ENV{'debug'} ? 1 : 0; my $address_trap_regexp = { + 'biglobe.ne.jp' => { 'start' => '----- The following addresses had delivery problems -----', 'end' => '----- Non-delivered information -----', }, + 'caiwireless.net' => { 'start' => 'the following recipients did not receive this message:', }, + 'compuserve.net' => { 'start' => 'your message could not be delivered', 'regexp' => 'Invalid receiver address: (\S+\@\S+)', }, + + 'nifty.ne.jp' => { + 'start' => '----- Unsent reason follows --', + 'end' => '----- Unsent message follows --', + 'regexp' => '(\S+) could not receive a mail that you had sent', + }, + + 'smail' => { 'start' => 'Failed addresses follow:', 'end' => 'Message text follows:', @@ -96,14 +107,25 @@ sub analyze sub _address_match { my ($self, $result, $rbuf) = @_; - my ($start_regexp, $end_regexp, $which, $state); + my ($match, $state); + + for my $which (keys %$address_trap_regexp) { + next unless $which; - for $which (keys %$address_trap_regexp) { - $start_regexp = $address_trap_regexp->{ $which }->{ 'start' }; - $end_regexp = $address_trap_regexp->{ $which }->{ 'end' }; - if ($$rbuf =~ /$start_regexp/) { $state = 1;} + my $start_regexp = $address_trap_regexp->{ $which }->{ 'start' }; + if ($$rbuf =~ /$start_regexp/) { + $match = $which; + $state = 1; + } } + # not found + return unless $match; + + # found + my $end_regexp = $address_trap_regexp->{ $match }->{ 'end' }; + my $addr_regexp = $address_trap_regexp->{ $match }->{ 'regexp' }; + # 1.1 o.k. we've found the start pattern !! if ($state == 1) { my @buf = split(/\n/, $$rbuf); @@ -114,9 +136,13 @@ sub _address_match last SCAN if /$end_regexp/; if (/(\S+\@\S+)/) { - my $addr = $1; - $addr =~ s/^<//; - $addr =~ s/>$//; + my $addr = $self->_clean_up($match, $1); + $result->{ $addr }->{ 'Final-Recipient' } = $addr; + $result->{ $addr }->{ 'Status'} = '5.x.y'; + } + + if (/$addr_regexp/) { + my $addr = $self->_clean_up($match, $1); $result->{ $addr }->{ 'Final-Recipient' } = $addr; $result->{ $addr }->{ 'Status'} = '5.x.y'; } @@ -125,6 +151,22 @@ sub _address_match } +sub _clean_up +{ + my ($self, $type, $addr) = @_; + + $addr =~ s/^<//; + $addr =~ s/>$//; + + if ($type eq 'nifty.ne.jp') { + return $addr .'@nifty.ne.jp'; + } + else { + $addr; + } +} + + =head1 AUTHOR Ken'ichi Fukamachi diff --git a/regress/testmails/error=nifty.ne.jp b/regress/testmails/error=nifty.ne.jp new file mode 100644 index 00000000..d682d3b9 --- /dev/null +++ b/regress/testmails/error=nifty.ne.jp @@ -0,0 +1,37 @@ +From Postmaster@mail.nifty.ne.jp Sat Oct 14 23:26:50 2000 +Return-Path: <Postmaster@mail.nifty.ne.jp> +Received: from ums512.nifty.ne.jp (ums512.nifty.ne.jp [10.20.30.4]) + by ahodori.fml.org (Postfix) with ESMTP id 1C50A8664B + for <fml-support-admin@ffs.fml.org>; Sat, 14 Oct 2000 23:26:49 +0900 (JST) +Received: (from root@localhost) + by ums512.nifty.ne.jp (8.9.3+3.2W/3.7W000809) id XAA03435; + Sat, 14 Oct 2000 23:27:14 +0900 (JST) +From: Postmaster@mail.nifty.ne.jp +Message-Id: <200010141427.XAA03435@ums512.nifty.ne.jp> +Date: Sat, 14 Oct 2000 23:25:00 +0900 +Subject: Returned mail: RUDO0000 did not receive a mail +To: fml-support-admin@ffs.fml.org + +----- Unsent reason follows ----- +RUDO0000 could not receive a mail that you had sent. +Because RUDO0000's mailbox in Nifty had been full. + +----- Unsent message follows ----- +Received: from ns.nuinui.net (ns.nuinui.net [10.20.30.27]) + by ums501.nifty.ne.jp (8.9.3+3.2W/3.7W991006) with ESMTP id XAA14368 + for <RUDO0000@nifty.ne.jp>; Sat, 14 Oct 2000 23:22:41 +0900 (JST) +Received: from ahodori.fml.org ([10.20.30.30]) + by ns.nuinui.net (8.9.3/8.9.3) with SMTP id XAA02030 + for <rudo@nuinui.net>; Sat, 14 Oct 2000 23:21:44 +0900 +From: fukachan@sapporo.iij.ad.jp (Ken'ichi Fukamachi) +To: elena@nuinui.net +Reply-To: rudo@nuinui.net +Subject: [elena:00300] test 01 + appended_mesg +Message-Id: <20010102080803.1BCBE15024@iris.fml.org> +Date: Tue, 2 Jan 2001 17:08:03 +0900 (JST) +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-2022-JP +Content-Transfer-Encoding: 7bit + +----- Message body suppressed ----- |
