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
Delete IMAP EmailTo delete an email, the "Deleted" flag must be set to 1 for each message to be deleted. You must also call Expunge or ExpungeAndClose to remove the emails marked as deleted. 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> #include <C_CkMessageSet.h> void ChilkatSample(void) { HCkImap imap; BOOL success; HCkMessageSet messageSet; BOOL fetchUids; // This example deletes email matching a criteria from Inbox. 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; } // Turn on session logging: 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,"myLogin","myPassword"); 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; } fetchUids = TRUE; // Get the message IDs for all emails having "FTP2" in the subject. messageSet = CkImap_Search(imap,"SUBJECT FTP2",fetchUids); if (messageSet == 0 ) { printf("%s\n",CkImap_lastErrorText(imap)); return; } // Set the Deleted flag for each message: success = CkImap_SetFlags(imap,messageSet,"Deleted",1); if (success != TRUE) { printf("%s\n",CkImap_lastErrorText(imap)); return; } // Expunge and close the mailbox. success = CkImap_ExpungeAndClose(imap); if (success != TRUE) { printf("%s\n",CkImap_lastErrorText(imap)); return; } // Display the session log. printf("%s\n",CkImap_sessionLog(imap)); // Disconnect from the IMAP server. CkImap_Disconnect(imap); CkMessageSet_Dispose(messageSet); CkImap_Dispose(imap); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.