C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

Search/Download only Encrypted Emails

Searching an IMAP mailbox for emails that are encrypted and download. Emails are automatically decrypted.

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

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;
}

//  Connect to an IMAP server.
success = imap.Connect("www.cknotes.com");
if (success != true) {
    MessageBox.Show(imap.LastErrorText);
    return;
}

//  Login
success = imap.Login("myLogin","myPassword");
if (success != true) {
    MessageBox.Show(imap.LastErrorText);
    return;
}

//  Select an IMAP mailbox
success = imap.SelectMailbox("Inbox");
if (success != true) {
    MessageBox.Show(imap.LastErrorText);
    return;
}

//  An S/MIME encrypted email should have a content-type
//  header containing the substring "pkcs7-mime":
string headerSearch;
headerSearch = "HEADER Content-Type pkcs7-mime";

Chilkat.MessageSet messageSet = null;
bool fetchUids;
fetchUids = true;
messageSet = imap.Search(headerSearch,fetchUids);
if (messageSet == null ) {
    MessageBox.Show(imap.LastErrorText);
    return;
}

//  Download the emails indicated in the messageSet.
//  The emails are automatically decrypted.
Chilkat.EmailBundle bundle = null;
bundle = imap.FetchBundle(messageSet);
if (bundle == null ) {

    MessageBox.Show(imap.LastErrorText);
    return;
}

//  Display some information from each email:
int i;
for (i = 0; i <= bundle.MessageCount - 1; i++) {
    Chilkat.Email email = null;
    email = bundle.GetEmail(i);

    textBox1.Text += email.GetHeaderField("Date") + "\r\n";
    textBox1.Text += email.Subject + "\r\n";
    textBox1.Text += email.From + "\r\n";

    textBox1.Text += "Received Encrypted: " + email.ReceivedEncrypted + "\r\n";
    if (email.ReceivedEncrypted == true) {
        textBox1.Text += "Successfully Decrypted: "
             + email.Decrypted + "\r\n";
    }

    textBox1.Text += "Received Signed: " + email.ReceivedSigned + "\r\n";
    if (email.ReceivedSigned == true) {
        textBox1.Text += "Signature Verified: "
             + email.SignaturesValid + "\r\n";
    }

    textBox1.Text += "--" + "\r\n";

}

//  Disconnect from the IMAP server.
imap.Disconnect();


 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Email Component · XML Parser