Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
Classify Email as Bounce (DSN) or Automated ReplyDemonstrates how to use the Chilkat Bounce component to determine if an email is an bounce (DSN) or an automated reply.
#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.