Sample code for 30+ languages & platforms
Perl Requires Chilkat v11.0.0+

Transition from Imap.FetchSingleHeader to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingleHeader method calls with FetchEmail.

Chilkat Perl Downloads

Perl
use chilkat();

$success = 0;

$imap = chilkat::CkImap->new();

#  ...
#  ...

#  ------------------------------------------------------------------------
#  The FetchSingleHeader method is deprecated:

# emailObj is a Email
$emailObj = $imap->FetchSingleHeader(1,0);
if ($imap->get_LastMethodSuccess() == 0) {
    print $imap->lastErrorText() . "\r\n";
    exit;
}

#  ...
#  ...

#  ------------------------------------------------------------------------
#  Do the equivalent using FetchEmail.
#  Your application creates a new, empty Email object which is passed 
#  in the last argument and filled upon success.

$headerOnly = 1;

$emailOut = chilkat::CkEmail->new();
$success = $imap->FetchEmail($headerOnly,1,0,$emailOut);
if ($success == 0) {
    print $imap->lastErrorText() . "\r\n";
    exit;
}