summaryrefslogtreecommitdiff
path: root/fml/lib/Mail
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-04-12 04:43:05 +0000
committerfukachan <fukachan>2001-04-12 04:43:05 +0000
commit24ddffe87ee79f37f15125c0c899b221b795582e (patch)
tree6a798a1df75e4ada824e38f4c807ab5f772e330d /fml/lib/Mail
parent321c99834aa544781158dc4297e43e3bafa336da (diff)
downloadfml8-24ddffe87ee79f37f15125c0c899b221b795582e.tar.gz
fml8-24ddffe87ee79f37f15125c0c899b221b795582e.tar.bz2
fml8-24ddffe87ee79f37f15125c0c899b221b795582e.zip
enable to parse nifty.ne.jp error pattern
Diffstat (limited to 'fml/lib/Mail')
-rw-r--r--fml/lib/Mail/Bounce/SimpleMatch.pm60
1 files changed, 51 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