PHP Requires Chilkat v11.0.0+
Chilkat2 PHP
POP3 Fetch Mime Source of Email by UIDL
Demonstrates how to fetch the MIME source of a single email by UIDL.Chilkat PHP Downloads
<?php
use Chilkat2\BinData;
use Chilkat2\MailMan;
use Chilkat2\StringTable;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$mailman = new MailMan();
$mailman->MailHost = 'pop.example.com';
$mailman->PopUsername = 'myLogin';
$mailman->PopPassword = 'myPassword';
$mailman->MailPort = 995;
$mailman->PopSsl = true;
$stUidls = new StringTable();
try {
$mailman->FetchUidls($stUidls);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
// Download each email as MIME.
$bdMime = new BinData();
$count = $stUidls->Count;
$i = 0;
while ($i < $count) {
try {
$mailman->FetchMimeBd($stUidls->StringAt($i), $bdMime);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
// Do whatever is needed with the MIME contained in bdMime.
$i = $i + 1;
}