Programming Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

C Examples

Bounced Mail
Bz2
Certificates/Keys
Charset
CSV
Diffie-Hellman
DSA
Email Object
Encryption
FileAccess
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
MIME
POP3
RSA
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
Zip


 

 

 

 

 

 

 

 

Classify Email as Bounce (DSN) or Automated Reply

Demonstrates how to use the Chilkat Bounce component to determine if an email is an bounce (DSN) or an automated reply.

Download Chilkat C/C++ Libraries for VC++ 9.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 8.0 / Win32

Download Chilkat C/C++ 64-bit Libraries for VC++ 8.0 / x64

Download Chilkat Visual Studio 2005 C/C++ Libs for Windows Mobile, Pocket PC, SmartPhone, WinCE

Download Chilkat C/C++ Libraries for VC++ 7.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0, Win 95/98/NT4 Compatible

#include <C_CkBounce.h>
#include <C_CkEmail.h>

void ChilkatSample(void)
    {
    HCkBounce bounce;
    BOOL success;
    HCkEmail email;

    bounce = CkBounce_Create();

    success = CkBounce_UnlockComponent(bounce,"Anything for 30-day trial");
    if (success == FALSE) {
        printf("Failed to unlock component\n");
        return;
    }

    email = CkEmail_Create();

    //  Load an email from a .eml file.
    //  (This example loads an Email object from a .eml file,
    //  but the object could have been read
    //  directly from a POP3 or IMAP mail server using
    //  Chilkat's POP3 or IMAP implementations.)
    success = CkEmail_LoadEml(email,"sampleBounce.eml");
    if (success == FALSE) {
        printf("%s\n",CkEmail_lastErrorText(email));
        return;
    }

    success = CkBounce_ExamineEmail(bounce,email);
    if (success == FALSE) {
        printf("%s\n",CkBounce_lastErrorText(bounce));
        return;
    }

    if (CkBounce_getBounceType(bounce) == 1) {
        //  Hard bounce, log the email address
        printf("Hard Bounce: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 2) {
        //  Soft bounce, log the email address
        printf("Soft Bounce: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 3) {
        //  General bounce, no email address available.
        printf("General Bounce: No email address\n");
    }

    if (CkBounce_getBounceType(bounce) == 4) {
        //  General bounce, log the email address
        printf("General Bounce: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 5) {
        //  Mail blocked, log the email address
        printf("Mail Blocked: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 6) {
        //  Auto-reply, log the email address
        printf("Auto-Reply: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 7) {
        //  Transient (recoverable) Failure, log the email address
        printf("Transient Failure: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 8) {
        //  Subscribe request, log the email address
        printf("Subscribe Request: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 9) {
        //  Unsubscribe Request, log the email address
        printf("Unsubscribe Request: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 10) {
        //  Virus Notification, log the email address
        printf("Virus Notification: %s\n",CkBounce_bounceAddress(bounce));
    }

    if (CkBounce_getBounceType(bounce) == 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.
        printf("Suspected Bounce!\n");
    }


    CkBounce_Dispose(bounce);
    CkEmail_Dispose(email);

    }

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

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