Tom Phoenix wrote:
Mail::DeliveryStatus::BounceParser... it doesn't work

Maybe you need to fix that module so that it works for you, or to use
a different module, or even to write parsing code from scratch. If you
can't find a more suitable module for your needs, you could try
Parse::RecDescent.

Hi Tom,

Thanks for this, I've decided to write it from scratch, and could do with some help!

The explanation of Parse::RecDescent at:
http://search.cpan.org/dist/Parse-RecDescent/lib/Parse/RecDescent.pm

Doesn't make sense to me, I don't understand the language but I'm sure with a little work I'll get it. Can you recommend an article/tutorial that will give me a simpler introduction to the concepts of parsing?

I can write regexes and have been working on parsing the bounces with them but I think I could do better using parsing techniques and modules that I don't understand right now.

I've extracted the content-type and subject from the email headers and am about to start working on getting the rejected email address.

Here's what I have so far...

foreach my $message_id ( @$messages ) {
        
        my $message = join ( '', @{$receiver->message( $message_id )} );
        
        my $message_data = {};
        
        ( $message_data->{header}, $message_data->{body} ) =
$message =~ /^ (.+?) (?: (?:\015\012\015\012|\015\015|\012\012) (.+) |) $/sx
                        or main::error ( 'Failed to parse message.' );
        
        ( $message_data->{content_type} ) =
$message_data->{header} =~ /^ ( Content-Type:.+ (?: (?: (?:\015\012|\015|\012) \s+.+ ) |) ) $/imx;
        
        ( $message_data->{subject} ) =
                $message_data->{header} =~ /^ ( Subject:.* ) $/imx;
        
}

Good luck with it!

Thanks :)

Cheers,
Nigel

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to