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.
Chilkat.Imap imap = new Chilkat.Imap(); bool success; // Anything unlocks the component and begins a fully-functional 30-day trial. success = imap.UnlockComponent("Anything for 30-day trial"); if (success != true) { MessageBox.Show(imap.LastErrorText); return; } imap.KeepSessionLog = true; // Connect to an IMAP server. success = imap.Connect("mail.chilkatsoft.com"); if (success != true) { MessageBox.Show(imap.LastErrorText); return; } // Login success = imap.Login("***","***"); if (success != true) { MessageBox.Show(imap.LastErrorText); return; } // Select an IMAP mailbox success = imap.SelectMailbox("Inbox"); if (success != true) { MessageBox.Show(imap.LastErrorText); return; } // Assume we know that the UID for the email in question is 2: string response; response = imap.SendRawCommand("UID STORE 2 +FLAGS.SILENT (\Seen)"); textBox1.Text += response + "\r\n"; // Disconnect from the IMAP server. imap.Disconnect(); textBox1.Text += imap.SessionLog + "\r\n"; |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.