Orange is my favorite color

James Moberg asked how to use BounceDetector without Coldspring this morning. Personally, I think you’re crazy if you don’t use Coldspring, but I whipped up a demo in order to explain how to parse the bounce signatures database and manually create the BounceDetector instance if desired. You can find the file in subversion called demowithoutcoldspring.cfm. The only real work is parsing the XML and replicating the functionality in Coldspring that creates an array of structs from an argument that uses the <map> and <list> tags:

<cffile action="read" file="#expandPath('bouncedetector.xml')#" variable="xmlBD" />
<cfset xml = xmlParse(xmlBD) />
<cfset arr = xml.beans.bean[1]["constructor-arg"].list.xmlChildren />

<cfset sigs = arrayNew(1) />
<cfloop from="1" to="#arrayLen(arr)#" index="ii">
	<cfset n = {signature = arr[ii].xmlChildren[1].xmlChildren[1].xmlText
			,weight = arr[ii].xmlChildren[2].xmlChildren[1].xmlText } />
	<cfset arrayAppend(sigs, n) />
</cfloop>

<cfset bd = createObject("component", "bouncedetector") />
<cfset bd.init(mailBounceSignatures = sigs) />

But seriously, just drop in Coldspring!

2 Comments

  1. James Moberg said:

    on October 6, 2009 at 4:13 pm

    Your scritps don’t come with much documentation. I installed Coldspring since you thought I was crazy. After messing around for a while, I figured out that BounceDetector needed to be copied into a /PUKKA_API_MAP/bouncedetector/ sub-directory. I don’t think I’m going crazy… please tell me that this wasn’t documented anywhere and that you don’t actually assume that developers will instinctively know this without first getting multiple errors, cursing the lack of documentation, and troubleshooting it on their own. (There are only 35 results when searching Google for “PUKKA_API_MAP” so that didn’t help out much.)

    I installed 120 additional files and configured a CF mapping in order to get the ColdSpring demo to work versus the non-Coldspring demo (single CFC and XML file) which worked right out of the box.

    Thanks for doing this.

  2. brian said:

    on October 6, 2009 at 4:33 pm

    James – It’s true there isn’t much documentation but there isn’t much to the bounce detector. The real value is in the list of signatures. If I told you that /PUKKA_API_MAP/ is simply a mapping to my root directory, would that make it more obvious what needs to be changed?

    For the Coldspring users, something like:

    1. Edit bouncedetector.xml and change PUKKA_API_MAP to a mapping for your application. If you put bouncedetector as a directory off the root, you could remove it altogether. Otherwise you might consider adding a “bouncedetector” mapping and changing it to read “bouncedetector.bouncedetector”.

    2. Load file using coldspring as shown in demo.cfm and use it.

    If you already use coldspring, you could instead import the bouncedetector definitions into your existing XML like so:

    <import resource=”/PUKKA_API_MAP/bouncedetector/bouncedetector.xml” />

    For non-CS users, just grab the demowithoutcoldspring.cfm and drop into place. No need to change the PUKKA_API_MAP or set up a mapping as described above.

    The reason this is prepackaged as a Coldspring drop-in is that Coldspring makes managing complex CFC dependencies easy. The bouncedetector is just a small widget designed to be part of a larger application – the kind that Coldspring is an expert as managing.

{ RSS feed for comments on this post}