Sample code for 30+ languages & platforms
PHP ActiveX

Transition from Imap.FetchChunk to Imap.FetchRange

Provides instructions for replacing deprecated FetchChunk method calls with FetchRange.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

$imap = new COM("Chilkat.Imap");

// ...
// ...

$startSeqNum = 1;
$count = 5;

$failedSet = new COM("Chilkat.MessageSet");
$fetchedSet = new COM("Chilkat.MessageSet");

// ------------------------------------------------------------------------
// The FetchChunk method is deprecated:

// bundleObj is a Chilkat.EmailBundle
$bundleObj = $imap->FetchChunk($startSeqNum,$count,$failedSet,$fetchedSet);
if ($imap->LastMethodSuccess == 0) {
    print $imap->LastErrorText . "\n";
    exit;
}

// ...
// ...

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

$headersOnly = 0;

$bundleOut = new COM("Chilkat.EmailBundle");
$success = $imap->FetchRange($headersOnly,$startSeqNum,$count,$bundleOut);
if ($success == 0) {
    print $imap->LastErrorText . "\n";
    exit;
}


?>