in reply to email and MIME?

In addition to grinder I would like to advice you to have a further look at MIME::Entity.

Using its methods mime_type resp. effective_type on each MIME part you may find the "text/plain" part and process it.

You may use these methods on MIME::Parser objects.

############################################################ sub split_entity { ############################################################ local $entity = shift; # needs a MIME::Entity object 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 # text if ($entity->effective_type =~ /^text\/(?!(html|enriched))/) { # do something } else { # do something different } } }

alex pleiner <alex@zeitform.de>
zeitform Internet Dienste

Replies are listed 'Best First'.
Re: Re: email and MIME?
by cez (Novice) on Sep 25, 2001 at 21:11 UTC
    thank you for the replies

    I guess thats a 'no' on the existing scripts, I'm a little surprised there isn't already some perl module to deal with these things a little more intelligently..

    the problem is, email includes some fun surprises like nested messages (with full headers) that most existing email readers are smart enough to understand, and process/display correctly. This isn't really a big deal, since we're not dealing with something very complicated here.. but this is a personal project, so I was hoping there was something already out there..

    thanks again

      Don't be that pessimistic. The MIME-Tools and the above sub do a great job for me separating text and non-text MIME components. As long as the mailer that sent the mail has ever heard about the relevant RFCs it is easy to handle.

      If you don't believe, have a look at this webmailer (in German, but guessable) using the above sub.

      For the fun surprises, notice the recursive call of that sub.

      alex pleiner <alex@zeitform.de>
      zeitform Internet Dienste