[Mimedefang] extract body from INPUTMSG?

David F. Skoll dfs at roaringpenguin.com
Tue Mar 10 16:09:48 EDT 2015


On Tue, 10 Mar 2015 15:39:59 -0400
Joseph Brennan <brennan at columbia.edu> wrote:

> if (open(IN, '<', './INPUTMSG')) {
>      while (<IN>) {
> 	# stuff it into a variable?
>      }
> close(IN);

That works, as does this which does it all in
one slurp and avoids repeated string appends:

my $slurped;
if (open(IN, '<', './INPUTMSG')) {
    local $/;
    $slurped = <IN>;
    close(IN);
}

However, that gets you the raw un-decoded MIME message.  The original
poster asked for the "text body" which is ambiguous.  A message might
have multiple text/* parts.

Regards,

David.


More information about the MIMEDefang mailing list