Node.js
Node.js
POP3 Fetch Mime Source of Email by UIDL
Demonstrates how to fetch the MIME source of a single email by UIDL.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var mailman = new chilkat.MailMan();
mailman.MailHost = "pop.example.com";
mailman.PopUsername = "myLogin";
mailman.PopPassword = "myPassword";
mailman.MailPort = 995;
mailman.PopSsl = true;
var stUidls = new chilkat.StringTable();
success = mailman.FetchUidls(stUidls);
if (success == false) {
console.log(mailman.LastErrorText);
return;
}
// Download each email as MIME.
var bdMime = new chilkat.BinData();
var count = stUidls.Count;
var i = 0;
while (i < count) {
success = mailman.FetchMimeBd(stUidls.StringAt(i),bdMime);
if (success == false) {
console.log(mailman.LastErrorText);
return;
}
// Do whatever is needed with the MIME contained in bdMime.
i = i+1;
}
}
chilkatExample();