(.NET Core C#) POP3 Fetch a Single Email by UIDL
Demonstrates how to fetch a single email by UIDL.
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.MailMan mailman = new Chilkat.MailMan();
mailman.MailHost = "pop.example.com";
mailman.PopUsername = "myLogin";
mailman.PopPassword = "myPassword";
mailman.MailPort = 995;
mailman.PopSsl = true;
Chilkat.StringArray sa = mailman.GetUidls();
if (mailman.LastMethodSuccess == false) {
Debug.WriteLine(mailman.LastErrorText);
return;
}
// Download each email by UIDL.
string uidl;
int i = 0;
int numUidls = sa.Count;
while (i < numUidls) {
uidl = sa.GetString(i);
Debug.WriteLine(uidl);
Chilkat.Email email = mailman.FetchEmail(uidl);
if (mailman.LastMethodSuccess == false) {
Debug.WriteLine(mailman.LastErrorText);
return;
}
Debug.WriteLine(email.Subject);
Debug.WriteLine("");
i = i + 1;
}
|