Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(MFC) Find the "Sent" IMAP MailboxFind the "Sent" IMAP mailbox. Also finds the Junk and Trash mailboxes..
#include <CkImap.h> #include <CkMailboxes.h> void ChilkatSample(void) { CkString strOut; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkImap imap; imap.put_Ssl(true); imap.put_Port(993); bool success = imap.Connect("imap.yourmailserver.com"); if (success != true) { strOut.append(imap.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } // Login or authenticate in some way.. success = imap.Login("your_login","your_password"); if (success != true) { strOut.append(imap.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } // Get the list of mailboxes. const char *refName = ""; const char *wildcardedMailbox = "*"; CkMailboxes *mboxes = imap.ListMailboxes(refName,wildcardedMailbox); if (imap.get_LastMethodSuccess() == false) { strOut.append(imap.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } // The mailbox with the "/Sent" flag is the "Sent" mailbox. // Likewise for Junk and Trash.. int i = 0; while (i < mboxes->get_Count()) { if (mboxes->HasFlag(i,"\\Sent") == true) { strOut.append("Sent mailbox: "); strOut.append(mboxes->getName(i)); strOut.append("\r\n"); } if (mboxes->HasFlag(i,"\\Junk") == true) { strOut.append("Junk mailbox: "); strOut.append(mboxes->getName(i)); strOut.append("\r\n"); } if (mboxes->HasFlag(i,"\\Trash") == true) { strOut.append("Trash mailbox: "); strOut.append(mboxes->getName(i)); strOut.append("\r\n"); } i = i + 1; } // Disconnect from the IMAP server. success = imap.Disconnect(); delete mboxes; SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); } |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.