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