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
Send IMAP Raw Command and Receive ResponseDemonstrates how to send an arbitrary (raw) command to an IMAP server and receive the response. This example will set the "Seen" flag for an email with a pre-known UID. Note: Normally, you would call the SetFlag method to set a flag. This example only serves to show how SendRawCommand is used. 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_CkImap.h> void ChilkatSample(void) { HCkImap imap; BOOL success; const char * response; imap = CkImap_Create(); // Anything unlocks the component and begins a fully-functional 30-day trial. success = CkImap_UnlockComponent(imap,"Anything for 30-day trial"); if (success != TRUE) { printf("%s\n",CkImap_lastErrorText(imap)); return; } CkImap_putKeepSessionLog(imap,TRUE); // Connect to an IMAP server. success = CkImap_Connect(imap,"mail.chilkatsoft.com"); if (success != TRUE) { printf("%s\n",CkImap_lastErrorText(imap)); return; } // Login success = CkImap_Login(imap,"***","***"); if (success != TRUE) { printf("%s\n",CkImap_lastErrorText(imap)); return; } // Select an IMAP mailbox success = CkImap_SelectMailbox(imap,"Inbox"); if (success != TRUE) { printf("%s\n",CkImap_lastErrorText(imap)); return; } // Assume we know that the UID for the email in question is 2: response = CkImap_sendRawCommand(imap,"UID STORE 2 +FLAGS.SILENT (\Seen)"); printf("%s\n",response); // Disconnect from the IMAP server. CkImap_Disconnect(imap); printf("%s\n",CkImap_sessionLog(imap)); CkImap_Dispose(imap); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.