BEFORE you go on, please check CPAN for the MIME-tools package, and read the documentation of MIME::Entity, MIME::Head, MIME::Body and MIME::Parser if you really want to parse emails correctly.
Else you are reinventing the wheel and yours won't be that round ...
Please be free to contact me if you need some demo code to show how the MIME-tools operate on your special task.
Update (some code snippets added)
use MIME::Parser; # some code here .... my $message = $pop->get($msg); # I get it from POP3 # parse email my $parser = new MIME::Parser; $parser->output_under($Conf::msg_dir); my $entity = $parser->parse_data($message); split_entity($entity); # example header my $from = $entity->head->decode->get("From"); ############################################################ sub split_entity { ############################################################ local $entity = shift; my $num_parts = $entity->parts; # how many mime parts? if ($num_parts) { # we have a multipart mime message foreach (1..$num_parts) { split_entity( $entity->parts($_ - 1) ); } } else { # we have a single mime message/part # we only want text if ($entity->effective_type =~ /^text\/(?!(html|enriched))/) { my $path = $entity->bodyhandle->path; ### do something here } else { my $path = $entity->bodyhandle->path; ### do something other here; } } }
This snippet is just for demonstration, it won't run.
alex pleiner <alex@zeitform.de>
zeitform Internet Dienste
In reply to Re: Email STDIN
by projekt21
in thread Email STDIN
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |