dans.blog


The miscellaneous ramblings and thoughts of Dan G. Switzer, II

Programmatically Reading ColdFusion's Mail "Spool Interval" Setting

I was working on some code today and needed to determine what the value of the "Spool Interval" was in the CF Administrator. After playing around for a few minutes, this is what I came up with. This code uses non-documented functionality, but I've tested the code under CFMX 6.1 and CFMX 7 and it seems to work fine. Obviously, if Macromedia changes internal workings of ColdFusion, this code may break in the future.

<!---// create a reference to the CF ServiceFactory //--->
<cfobject
    action="create"
    type="java"
    class="coldfusion.server.ServiceFactory"
    name="oFactory"
    />

<!---// get the mail spool service //--->
<cfset oMailSpool = oFactory.getMailSpoolService()>
<!---// get the mail spool interval schedule in seconds //--->
<cfset iSpoolInterval = (oMailSpool.getSchedule() / 1000)>