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 HeadersDownloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries C++ code to download email headers from a POP3 mail server. // The Chilkat Email library is also available as an ActiveX component
// or .NET class with the identical set of methods and properties.
// Fetch POP3 email headers
void EmailExample(void)
{
CkString str;
CkMailMan mailman;
// Any string passed to UnlockComponent begins the 30-day trial.
bool unlocked = mailman.UnlockComponent("30-day trial");
if (!unlocked)
{
printf("Failed to unlock component\n");
return;
}
mailman.put_MailHost("mail.chilkatsoft.com");
mailman.put_PopUsername("matt");
mailman.put_PopPassword(myPassword);
// Set the POP3 port to the standard MS Exchange Server SSL POP3 port 995
// mailman.put_MailPort(995);
// Tell the mailman to connect to POP3 using SSL
// mailman.put_PopSsl(true);
CkEmailBundle *bundle = 0;
// Use GetAllHeaders to fetch each email header and the 1st N lines of
// the body from a POP3 server.
// Note: Attachment information will not be available. This is a shortfall
// of the POP3 protocol because attachment information is not included
// in POP3 headers. An entire POP3 email must be read in order to get complete
// attachment information.
bundle = mailman.GetAllHeaders(2); // Get 2 body lines...
if (!bundle)
{
mailman.LastErrorText(str);
printf("%s",str.getString());
return;
}
int i;
int n = bundle->get_MessageCount();
for (i=0; i<n; i++)
{
CkEmail *email = bundle->GetEmail(i);
email->get_Subject(str);
printf("Subject: %s\n",str.getString());
email->get_From(str);
printf("From: %s\n",str.getString());
delete email;
}
delete bundle;
return;
}
|
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.