Programming Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C Examples

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

 

 

 

 

 

 

 

 

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.

Downloads:

MS Windows Visual C/C++ Libraries
Linux/CentOS C/C++ Libraries
MAC OS X C/C++ Libraries
Solaris C/C++ Libraries
C++ Builder Libraries
FreeBSD C++ Libraries
HP-UX C++ Libraries
BlackBerry QNX C++ Libraries
#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);

    }

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