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

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 React Native Downloads

React Native
import { Email, MailMan, StringTable } from '@chilkat/react-native'

async function chilkatExample() {
  // This example requires the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  const mailman = new MailMan();

  mailman.mailHost = 'pop.example.com';

  mailman.popUsername = 'myLogin';
  mailman.popPassword = 'myPassword';

  mailman.mailPort = 995;
  mailman.popSsl = true;

  const stUidls = new StringTable();
  try {
    await mailman.fetchUidlsAsync(stUidls);
  } catch {
    console.log(mailman.lastErrorText);
    return;
  }

  // Download each email by UIDL.
  const email = new Email();

  const count = stUidls.count;
  let i = 0;
  while (i < count) {
    // Download the full email.
    const uidl = stUidls.stringAt(i);
    try {
      await mailman.fetchByUidlAsync(uidl, false, 0, email);
    } catch {
      console.log(mailman.lastErrorText);
      return;
    }

    console.log(i);
    console.log(`UIDL: ${uidl}`);
    console.log(`From: ${email.from}`);
    console.log(`Subject: ${email.subject}`);

    i++;
  }

  await mailman.pop3EndSessionAsync();
}