React Native Requires Chilkat v11.0.0+
React Native
POP3 Fetch Mime Source of Email by UIDL
Demonstrates how to fetch the MIME source of a single email by UIDL.Chilkat React Native Downloads
import { BinData, 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 as MIME.
const bdMime = new BinData();
const count = stUidls.count;
let i = 0;
while (i < count) {
try {
await mailman.fetchMimeBdAsync(stUidls.stringAt(i), bdMime);
} catch {
console.log(mailman.lastErrorText);
return;
}
// Do whatever is needed with the MIME contained in bdMime.
i++;
}
}