Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
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. Downloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries #include <C_CkMailMan.h> #include <C_CkStringArray.h> #include <C_CkEmail.h> void ChilkatSample(void) { HCkMailMan mailman; BOOL success; HCkStringArray sa; long i; long n; HCkEmail email; const char * uidl; // The mailman object is used for receiving (POP3) // and sending (SMTP) email. mailman = CkMailMan_Create(); // Any string argument automatically begins the 30-day trial. success = CkMailMan_UnlockComponent(mailman,"30-day trial"); if (success != TRUE) { printf("Component unlock failed\n"); return; } // Set the POP3 server's hostname CkMailMan_putMailHost(mailman,"mail.chilkatsoft.com"); // Set the POP3 login/password. CkMailMan_putPopUsername(mailman,"myLogin"); CkMailMan_putPopPassword(mailman,"myPassword"); sa = CkMailMan_GetUidls(mailman); if (sa == 0 ) { printf("%s\n",CkMailMan_lastErrorText(mailman)); return; } n = CkStringArray_getCount(sa); for (i = 0; i <= n - 1; i++) { uidl = CkStringArray_getString(sa,i); email = CkMailMan_FetchEmail(mailman,uidl); if (email == 0 ) { printf("%s\n",CkMailMan_lastErrorText(mailman)); break; } printf("%s\n",CkEmail_ck_from(email)); printf("%s\n\n",CkEmail_subject(email)); CkEmail_Dispose(email); } CkStringArray_Dispose(sa); CkMailMan_Pop3EndSession(mailman); CkMailMan_Dispose(mailman); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.