Solution found for base64 emails

I think I have a solution for base64 emails. I emailed Matthew Seaman on Wednesday about this issue. He put me onto two very useful Perl modules:

The solution is coded below:

sub myGetMessage {
    my ($message);
    my ($encoding);

    while (<>) {
        $message .= $_;
    }

    $encoding = myGetMessage_ContentTransferEncoding($message);
    print $encoding;

    if ($encoding eq 'base64')
    {
        # we need to extract the body from this message, base64 decode it, and go from there...
        my $parsed = Email::MIME->new($message);
        my $content_type = $parsed->content_type;

        $parsed->body_set($parsed->body);

        my $header = $parsed->header_obj;
        $message = $header->as_string . $parsed->body_str;

    }

    return $message;
}

I have yet to use this against any real commits, but it works just fine against the test message I have here.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

1 thought on “Solution found for base64 emails”

Leave a Comment

Scroll to Top