in reply to Re^2: read email-message
in thread read email-message

Try using ($msgid,1) in ->bodypart_string

#!/usr/bin/perl use strict; use Mail::IMAPClient; my $client = Mail::IMAPClient->new( Server => 'imap.gmail.com', User => 'abc@gmail.com', Password => '**********', Ssl => 1, Uid => 1, ); $client->select("INBOX"); my @messages = $client->messages; my $msgid = pop @messages; my $text = $client->bodypart_string($msgid,1) or die "Could not get bodypart string: ", $client->LastError; print $text; $client->logout or die "Logout error: ", $client->LastError, "\n";
poj

Replies are listed 'Best First'.
Re^4: read email-message
by Anonymous Monk on Dec 17, 2017 at 11:05 UTC

    Looks better, thank you. Maybe someone could tell where i can find documentation on this issue?

      In the Mail::IMAPClient documentation, the second parameter to ->bodypart_string is documented.

      I'm not sure what more documentation you need.

      Be aware that a MIME mail has multiple parts and the first part is not necessarily the part you want. This is why in my code, I look through the MIME types of all parts and choose the one most applicable.

        What i will do is look into MIME so i know which body parts i need.