Automatic Processing of Unsubscribe Requests via Outlook Rule

Options

Yes.  we all get them.  Who in your organization handles all those  manual requests that come out of Convio when someone tries to unsubscribe but the system isn't able to identify them?  Someone hopefully

At CARE, that person is me, and it's a royal PITA.  Up until today,  I had built out a lightweight tool webpage that simply let me copy and  paste the e-mail into a form field and hit submit and the convio API did  the rest.  Simple, easy...  and great when there are only a handfull to  run.  Well, I've been out of the office for several days and there were  about 100 or so backlogged.  I'm a code geek, as much as I hate to  admit it, and I'm also as lazy as the day is long.  So.  I built an a  better mousetrap for myself, and thought I'd share in case anyone is  interested.  Probably, Convio will remove this like they have several  other posts I've made that were fairly complex and technical, but oh  well, I'll give it one last try.  First off, yes, this will require some  technical knowledge and a few prerequisits for this solution to work.   Remember, this works on MY computer, your mileage may vary, but if  you're like some help, let me know!

  1. You must have  Perl install on your machine (I'm assuming Windows here since it's all  about Outlook -- you Mac users are SOL as usual...  makes ya think, huh?  Form over function and all that.........).  You can get that free from  http://www.activestate.com.  Just the vanilla install will do, but  remember where you install it, because that WILL MATTER.  I have mine  installed at "C:\\Perl" to make things easy on myself.
  2. I am using Outlook 2003.  Don't know if later version work the same way  or not.  Probably, but don't bet on it.
  3. My  computer is running Windows 7, but since the tools in use here don't  require Windows 7 to run, that should matter, as long as you have  Outlook, you should be fine.
  4. The rule I'm setting  up isn't designed to be a server-side rule, nor is it designed to run  automatically (generally, you don't want this type of rule running  without supervision...).

Ok, with that out of the way, here goes!

Part One:  The Perl script.

Attached to this document are two files.  One is called unsubproc_template.pl.  Download that and rename it to unsubproc.pl and remember where you put it.  Download the other one and put it in the same directory.  Open the upsubproc.pl file in a text editor.  On line 1, it says "#!C:/Perl -w"  This is the perl "shebang" line (don't ask, just accept the name and move on) -- change it so that it matches where your Perl processor was/is installed.  There are 5 things you need to edit in this file, they are all marked.  It's the URL for your API based on your site's instance, your API Key, your API Admin credentials and a path for this program's output log.  For simplicity sake, use the same path as the file -- can be anything though, if you want.  Note, though, to use slash characters "/" in the Perl file.

Part Two:  The Outlook script.

That's the easy part, not for the annoying Microsoft portion of this adventure:

  1. Open Outlook
  2. Go to Tools > Macros > Visual Basic Editor (or just key Alt+F11)
  3. You should see something on the right that says "Project1" and under it a folder that says "Microsoft Office Outlook Objects" -- expand that.
  4. You should now see something that says "ThisOutlookSession" -- click that (or maybe double click).
  5. Now, unless you or someone you know (or don't know....) has edit this before, you should have a blank document on the right.  Open the  OutlookVBACode.txt file and paste it, in it's entirety, here.  If you already have code there, simply remove the "Option Explicit" line from the text file first and paste the contents below whatever is already there.
  6. The only line you need to change is where it says "Const ExternalProcessor As String" -- Change that to be the path to the Perl script you installed above -- this time make sure to use BACKSLASHES "\\" instead since that's what Windows expects.

You don't need to edit anything else in this file.  Paste it, edit that path, and save it.  Then, File > Close and Return to Microsoft Outlook (or just key Alt+Q).

Part Three: The Rule

Now, it's the (more or less) easy part.  At least, its the part that you, dear reader, are most likely to be familiar with anyway.

  1. In Outlook, go to Tools > Rules and Alerts.
  2. Click New Rule
  3. Create rule conditions that are very specific to the Convio emails.  For example, I have conditions that allow this rule to file only when the e-mail is set TO the correct address and contains "Unsubscribe Request: "  (the From seems to show up as an On Behalf Of thing... so I didn't use that...).  When you're done, click Next.
  4. For the Action, scroll down and select "run a script"
  5. When prompted, select "Project1.ThisOutlookSession.ConsUnsubProc" as the script.  Probably you'll only have that one, but if you've done other custom work, or have installed other macros or something, there might be more there.  Click Next.
  6. Probably don't need any exceptions, just click Next.
  7. Give it a name -- I called mine Convio Unsubscribe Processor, but if you want to call it the Purple Cow Bucket or something, feel free (whatever floats your boat, chief).
  8. Don't set the rule as "on" because you don't want this running by itself (generally, it's a bad idea for rules that run scripts to run all willy nilly).
  9. Click Finish.

Part Four: Make it so!

So, it's all set up.  Lets see it in action, w00t!   Go to the email folder that has all the unsubscribe emails in it.  It doesn't have to be exclusive, since you set your rule up to only process the correct emails (right??).  If you didn't, any e-mail address that has a subject line with an e-mail address as the third word will get opted out....  By word, I mean and peice of text with a space before it.  So, if the subject line was "My Email: langford@care.org" then, langford@care.org would get opted off your list.  That's why the criteria you set up are are so important.

  1. Go to the folder, and click Tools > Rules and Alerts.
  2. Click Run Rules Now
  3. Check the box of the new rule you created in Part three, don't check any other boxes.
  4. Click Run Now -- you'll see a bunch of command prompt boxes open and close and depending on your internet connection, computer processor and the number of e-mails in the box, this could take a while.  It IS NOT DONE until all the command prompt boxes close.
  5. When done, click Close on the rules box and X out of the Rules and Alerts dialog.
  6. Now, open the log file that will have been created magically wherever it was you specificed in the Perl script.  You'll see the XML return data that the convio API threw back.  Generally, you should see success statements and Convio IDs, etc.  If you see any errors messages, you'll need to follow up on those manually since clearly, those e-mails didn't get opted out.
  7. Lastly, when you're done, you can delete, or file, or print out and roll around on (ew) all the unsub e-mails that you never actually had to open!  whoooohooooo!

Some Issues and Caveats:

  1. This process isn't deployable -- that is, you won't be able to deploy this to your org in any automatic way, it will instead have to be set up manually on each machine.
  2. Might be Outlook version sensitive.  I have Outlook 2003 and have no access to other versions either earlier or later (like Outlook 2000 or 2007 for example).
  3. If you don't have the correct rights to install software on your own machine, you may not be able to install Perl.
  4. Depending on the way your organzation has Outlook / Exchange set up, and depending on your permission settings on your computer, you may not be able to edit or save VBA macros
  5. If #3 or #4 happen to be true, you won't be able to use this.  Sorry...  Might be your IT department or administrator can help you.
  6. If you have other macros or modules running, there is potential for conflict, I don't have anything else running like that, so I didn't encounter any issues
  7. Clearly, you have to have an active internet connection.  duh.

Enjoy!

I would love to hear back from anyone who makes use of this.  Like I said, it works great for me, so I thought at the very least I would share.

-mike

Tagged:

Categories