C# Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
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...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

Bounced Email Handling

Demonstrates how to examine emails and detect which are bounced (automated) replies. Classifies each email according to the type of bounce.

Download: Chilkat .NET Assemblies

Chilkat.Bounce bounce = new Chilkat.Bounce();

bool success;
success = bounce.UnlockComponent("Anything for 30-day trial");
if (success == false) {
    MessageBox.Show(bounce.LastErrorText);
    return;
}

//  The mailman object is used for receiving (POP3)
//  and sending (SMTP) email.
Chilkat.MailMan mailman = new Chilkat.MailMan();

//  Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial");
if (success != true) {
    MessageBox.Show(mailman.LastErrorText);
    return;
}

//  Set the POP3 server's hostname
mailman.MailHost = "mail.chilkatsoft.com";

//  Set the POP3 login/password.
mailman.PopUsername = "myLogin";
mailman.PopPassword = "myPassword";

Chilkat.EmailBundle bundle = null;
//  Copy the all email from the user's POP3 mailbox
//  into a bundle object.  The email remains on the server.
//  (There are other methods for deleting email from a POP3 server.)
bundle = mailman.CopyMail();

if (bundle == null ) {
    MessageBox.Show(mailman.LastErrorText);
    return;
}

int i;
Chilkat.Email email = null;
for (i = 0; i <= bundle.MessageCount - 1; i++) {
    email = bundle.GetEmail(i);

    success = bounce.ExamineEmail(email);
    if (success == false) {
        MessageBox.Show(bounce.LastErrorText);
        return;
    }

    if (bounce.BounceType == 1) {
        //  Hard bounce, log the email address
        textBox1.Text += "Hard Bounce: " + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 2) {
        //  Soft bounce, log the email address
        textBox1.Text += "Soft Bounce: " + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 3) {
        //  General bounce, no email address available.
        textBox1.Text += "General Bounce: No email address" + "\r\n";
    }

    if (bounce.BounceType == 4) {
        //  General bounce, log the email address
        textBox1.Text += "General Bounce: " + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 5) {
        //  Mail blocked, log the email address
        //  A bounce occured because the sender was blocked.
        textBox1.Text += "Mail Blocked: " + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 6) {
        //  Auto-reply, log the email address
        textBox1.Text += "Auto-Reply: " + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 7) {
        //  Transient (recoverable) Failure, log the email address
        textBox1.Text += "Transient Failure: "
             + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 8) {
        //  Subscribe request, log the email address
        textBox1.Text += "Subscribe Request: "
             + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 9) {
        //  Unsubscribe Request, log the email address
        textBox1.Text += "Unsubscribe Request: "
             + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 10) {
        //  Virus Notification, log the email address
        textBox1.Text += "Virus Notification: "
             + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 11) {
        //  Suspected bounce.
        //  This should be rare.  It indicates that the Bounce
        //  component found strong evidence that this is a bounced
        //  email, but couldn't quite recognize everything it
        //  needed to be 100% sure.  Feel free to notify
        //  support@chilkatsoft.com regarding emails having this
        //  bounce type.
        textBox1.Text += "Suspected Bounce!" + "\r\n";
    }

    if (bounce.BounceType == 12) {
        //  Challenge/Response - Auto-reply message sent by SPAM software
        //  where only verified email addresses are accepted.
        textBox1.Text += "Challenge: " + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 13) {
        //  Address Change Notification Message.
        textBox1.Text += "Address Change: " + bounce.BounceAddress + "\r\n";
    }

    if (bounce.BounceType == 14) {
        //  Success DSN indicating that the message was successfully relayed.
        textBox1.Text += "DSN Successful Relay: " + "\r\n";
    }

}

mailman.Pop3EndSession();
 

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

Email Component · XML Parser