Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
Download POP3 Email using UIDLsDemonstrates how to download POP3 email by first getting the complete set of UIDLs and then downloading email by calling FetchEmail for each UIDL. This is equivalent to calling CopyMail, except your application can process each email as it arrives instead of waiting for the entire bundle to be downloaded. Also, it's better protection against potential out-of-memory issues if your mailbox has a very large number of messages. There is no performance difference between fetching emails individually vs. calling CopyMail.
#include <CkMailMan.h> #include <CkStringArray.h> #include <CkEmail.h> void ChilkatSample(void) { // The mailman object is used for receiving (POP3) // and sending (SMTP) email. CkMailMan mailman; // Any string argument automatically begins the 30-day trial. bool success; success = mailman.UnlockComponent("30-day trial"); if (success != true) { printf("Component unlock failed\n"); return; } // Set the POP3 server's hostname mailman.put_MailHost("mail.chilkatsoft.com"); // Set the POP3 login/password. mailman.put_PopUsername("myLogin"); mailman.put_PopPassword("myPassword"); CkStringArray *sa = 0; sa = mailman.GetUidls(); if (sa == 0 ) { printf("%s\n",mailman.lastErrorText()); return; } long i; long n; n = sa->get_Count(); CkEmail *email = 0; const char * uidl; for (i = 0; i <= n - 1; i++) { uidl = sa->getString(i); email = mailman.FetchEmail(uidl); if (email == 0 ) { printf("%s\n",mailman.lastErrorText()); break; } printf("%s\n",email->ck_from()); printf("%s\n\n",email->subject()); delete email; } delete sa; mailman.Pop3EndSession(); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.