PHP Requires Chilkat v11.0.0+
PHP
Retrieve UIDL's from POP3 Server
Retrieve a list of UIDLs from a POP3 server. UIDLs are unique identifiers, 1 to 70 characters long, composed of characters ranging from 0x21 to 0x7E. These identifiers uniquely distinguish messages within a mailbox and remain consistent across sessions.Chilkat PHP Downloads
<?php
use Chilkat2\Email;
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 by UIDL.
$email = new Email();
$count = $stUidls->Count;
$i = 0;
while ($i < $count) {
// Download the full email.
$uidl = $stUidls->StringAt($i);
try {
$mailman->FetchByUidl($uidl, false, 0, $email);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
echo $i, "\n";
echo 'UIDL: ', $uidl, "\n";
echo 'From: ', $email->From, "\n";
echo 'Subject: ', $email->Subject, "\n";
$i = $i + 1;
}
$mailman->Pop3EndSession();