Efficient Email Bounce AutomationEfficient Email Bounce Automation

   Home > Resources > How-To Articles > Article 2 - Simple Email Bounce Automation - Part 2
 

Simple Email Bounce Automation Using BounceStudio Enterprise
Part 2 of 2


Configure Visual Basic Script - BounceHandler.vbs

NOTE: If you haven't downloaded the BounceHandler.vbs file yet, then you'll want to return to the first page of this article and download it. Click here to return to the first page.

In this section, I'll show you how to configure the BounceHandler.vbs script to you needs. If you haven't already, then you'll want to open the BounceHandler.vbs script in your favorite vbscript text editor. If you don't have a vbscript text editor, then just use notepad.

Step 1 - Configure Database Path

The first thing you need to do is tell the BounceHandler.vbs script where your MS Access database file is located. My Access database is called email.mdb, and it's located in my "c:\temp" folder (Full path is: "c:\temp\email.mdb"). The path to your Access database may be different. There is a variable near the top of the script called sDbPath (see image below). You'll need to set this variable to be the path of your Access database.




Step 2 - Configure Bounce Category Action Variables

There are 4 action variables that you can edit based on the type of bounce each message is. The variables and their descriptions can be found in the following table:

VariableValuesDescription
isForwardMessageTrue or FalseYou may want to forward certain types of messages to yourself, or to someone else in your organization. For instance, I forward all NB and CR type messages to a real person within our company. Setting this variable to "True" tells the script to perform the "Email Forwarding" block of code further down in the script.
isSubscriptionRequestTrue or FalseThis variable should be set to "True" when the message is a subscription request type message (i.e. SR or UR). Setting this value to "True" tells the script to perform the "Handle Subscription Request" block of code further down in the script.
isPerformCounterUpdateTrue or FalseThis variable should be set to "True" when the message is an email bounce. When set to "True", the script will execute the "Update Bounce Counter" block of code further down in the script.
iBounceCountIncrementIntegerThe value of this variable is valid only when the "isPerformCounterUpdate" variable is set to "True". The value of this variable tells the script how much the BounceCount field should be incremented.


The image below illustrates how I've configured my Action Variables for a few of the different email bounce categories. You can configure your action variables however you like, and you may want to make changes to all of the Action Variables within each CASE code block in the script. It's up to you.



Non Bounce (NB) Messages - All "NB" messages will be forwarded to me because the isForwardMessage variable is set to "True".

Hard Bounce (HB) Messages - The isPerformCounterUpdate variable is set to "True", so the script will increment the BounceCount field, by a value of 3 (iBounceCountIncrement=3), of my EmailList table for the affected email address. All "HB" messages will not be forwarded to me because the isForwardMessage variable is set to "False".

Soft Bounce (sB) Messages - The isPerformCounterUpdate variable is set to "True", so the script will increment the BounceCount field, by a value of 1 (iBounceCountIncrement=1), of my EmailList table for the affected email address. All "SB" messages will not be forwarded to me because the isForwardMessage variable is set to "False".


Step 3 - Configure Email Forwarding

AUTHOR NOTE: Since this article was written, BounceStudio Enterprise now includes SMTP email forwarding. Email forwarding functionality really isn't needed in this script anymore, but we've left it in anyway for educational purposes.

If you want to forward certain types of messages to a particular email address, then you'll need to change the 3 lines of code highlighted in the image below. These lines of code tell the script where to forward the message too. By default, the script is configured to forward all NB and CR type messages.

NOTE: In order for the email forwarding to work properly, you must have the IIS SMTP Server service installed on the machine that you're running the BounceHandler.vbs script on. If you don't have this installed, then you should set all of your isForwardMessage variables to "False", and deal with the affected email bounce types appropriately.



Step 4 - Test Configuration

Now that you are done configuring the BounceHandler.vbs script to meet your needs, it's time to test it. Test the vbs script by double-clicking on it from Windows Explorer.

Below is a screenshot of some sample data, as viewed from MS Access, in the btBounceLog and EmailList table prior to executing the BounceHandler.vbs script.



If you were able to execute the script successfully, then you should see something that looks like the following after the script has completed (should take less than 1 second). Notice that the values of the Processed field within the btBounceLog table are now set to 1, indicating that the email bounce records have been handled. You can also see that the BounceCount field for certain records in the EmailList table have been incremented, and the StatusId of another record has changed. You may need to close out of the table and then open it again to see the changes.



If everything looks good, then it's time to move on to the next step. In the next step, you'll be configuring the BounceHandler.vbs script to run at a specified time interval via the Windows Task Scheduler.


Page: 1 | 2 | 3 | 4 | Continue to Page 3 >>






"BounceStudio is picking them up as fast as they come in and updating our database for us. It's great!"


Innes Borkwood
Nesco Group
©1999-2024 BoogieTools, Inc. All rights reserved.