diff options
| author | fukachan <fukachan> | 2001-04-12 11:44:54 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-04-12 11:44:54 +0000 |
| commit | ccb194ce361d802e9cf0834b233e0736054429b4 (patch) | |
| tree | 6af8805106262f1630c26b2d15e9c2d22c2597d6 | |
| parent | 9cd837322e464cf5a734bfabaa2188daeec96628 (diff) | |
| download | fml8-ccb194ce361d802e9cf0834b233e0736054429b4.tar.gz fml8-ccb194ce361d802e9cf0834b233e0736054429b4.tar.bz2 fml8-ccb194ce361d802e9cf0834b233e0736054429b4.zip | |
debug on if $ENV{'debug'} is defined
fix mail address parsing (XXX it should be moved to common module).
return result if real address is found.
| -rw-r--r-- | fml/lib/Mail/Bounce/DSN.pm | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/fml/lib/Mail/Bounce/DSN.pm b/fml/lib/Mail/Bounce/DSN.pm index 2ff8cd1d..33f94f72 100644 --- a/fml/lib/Mail/Bounce/DSN.pm +++ b/fml/lib/Mail/Bounce/DSN.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: DSN.pm,v 1.3 2001/04/09 15:31:48 fukachan Exp $ +# $FML: DSN.pm,v 1.4 2001/04/10 11:52:26 fukachan Exp $ # @@ -14,6 +14,9 @@ use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; +my $debug = $ENV{'debug'} ? 1 : 0; + + =head1 NAME Mail::Bounce::DSN - DSN error message format parser @@ -42,9 +45,10 @@ Mail::Bounce::DSN - DSN error message format parser sub analyze { my ($self, $msg, $result) = @_; - my $m; + my $m = $msg->rfc822_message_body_head; + $m = $m->find( { data_type => 'message/delivery-status' } ); - if ($m = $msg->find( { data_type => 'message/delivery-status' } )) { + if (defined $m) { # data in the part my $data = $m->data; my $n = $m->num_paragraph; @@ -80,14 +84,17 @@ sub _parse_dsn_format my $addr = $header->get('Original-Recipient') || $header->get('Final-Recipient'); - - if ($addr =~ /.*;\s*(\S+\@\S+)/) { $addr = $1;} + if ($addr =~ /.*;\s*(\S+\@\S+\w+)/) { + $addr = $1; + } # set up return buffer - $result->{ $addr }->{ 'Final-Recipient' } = $addr; - for ('Final-Recipient', 'Original-Recipient', - 'Action', 'Status', 'Diagnostic-Code') { - $result->{ $addr }->{ $_ } = $header->get($_) || undef; + if ($addr =~ /\@/) { + $result->{ $addr }->{ 'Final-Recipient' } = $addr; + for ('Final-Recipient', 'Original-Recipient', + 'Action', 'Status', 'Diagnostic-Code') { + $result->{ $addr }->{ $_ } = $header->get($_) || undef; + } } } |
