Our site has around15-20 different e-mails (all dynamically generated) that 
are triggered off based on different user actions, such as registration, 
unsubscribing etc. All the e-mails on our site are being sent out using one 
single template, i.e. the template is called using cfmodule with an 
attribute identifying the type of email, and any other attributes that may 
be required. A sample call may look like this :

<cfmodule template="mailingtemplate.cfm" mailtype="FirstReg" cnd_id="#cnd_id#">


The template mailingtemplate.cfm looks like this :


<cfset mailtype="#attributes.mailtype#">

<cfif mailtype is "NewCand">

        <!--- Dynamically generate email  and send it out--->

<cfelseif mailtype is "FirstReg">

        <!--- Dynamically generate email  and send it out--->

<cfelseif mailtype is "NewApply">

        <!--- Dynamically generate email  and send it out--->

<cfelseif mailtype is "NewCandAdmin">

        <!--- Dynamically generate email  and send it out--->

----- and so on ---

</cfif>

This template may have about 15-20 else if conditions. Would there be any 
improvement in performance if we were to use <cfswitch> <cfcase> instead ? 
The template would then then look like this:

<CFSWITCH mailtype="#attributes.mailtype#">
        
        <CFCASE VALUE="NewCand">
                <!--- Dynamically generate email  and send it out--->
        </CFCASE>
        
        <CFCASE VALUE="FirstReg">
                <!--- Dynamically generate email  and send it out--->
        </CFCASE>

        -- and so on --
        <CFDEFAULTCASE>
                <!--- Do nothing --->
        </CFDEFAULTCASE>

</CFSWITCH>


Vishal.

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to