Listing 1: AsynchE-mailer.cfc

<cfcomponent displayname="AsynchE-mailer" output="false" hint="Asynchronous
 CMFL gateway for sending of e-mails from the E-Mail Blaster">
    <cffunction name="onIncomingMessage" output="false">
        <cfargument name="CFEvent" type="struct" required="true" />

        <cfset logFileName = DateFormat(CFEvent.Data.sendTime, "YYYYMMDD") 
                & "_" & TimeFormat(CFEvent.Data.sendTime, "HHmmss") & ".txt" />
        <cffile action="write" file="#CFEvent.Data.logFilePath##logFileName#" 
		output="E-MAIL LOG FOR JOB RUN AT #DateFormat(CFEvent.Data.sendTime)#
		 #TimeFormat(CFEvent.Data.sendTime)#" 
                addnewline="yes" />

        <!--- get start tick count so we can calculate total time --->
        <cfset startTick = GetTickCount() />

        <cftry>
            <cfloop index="i" from="1" to="#ArrayLen(CFEvent.Data.?
			recipients)#" 
                    step="1">
                <cftry>
                    <cfmail from="#CFEvent.Data.fromName# <#CFEvent.Data. ?
					 fromE-mail#>" 
            replyto="#CFEvent.Data.replyToE-mail#" 
			to="#CFEvent.Data.recipients[i]#" 
			subject="#CFEvent.Data.subject#" 
			type="html">
                        #CFEvent.Data.content#
                    </cfmail>
                    <cfcatch type="any">
                        <!--- just proceed on --->
                    </cfcatch>
                </cftry>

                <!--- add line to log file so if this bombs, we know what ?  send
				 attempts 
                        were already made --->
                <cffile action="append" file="#CFEvent.Data.logFilePath##log?                  
				 FileName#" 
                        output="#CFEvent.Data.recipients[i]#" addnewline="yes" />
            </cfloop>

            <!--- calculate run time --->
            <cfset totalTime = (GetTickCount() - startTick) / 1000 />

            <!--- trap any errors --->
            <cfcatch type="any">
                <cfmail from="#CFEvent.Data.adminE-mail#" 
	         to="#CFEvent.Data.adminE-mail#" 
			 cc="#CFEvent.Data.userE-mail#" 
			 subject="E-Mail Send Error">
An error occured during an e-mail blast send process.  The system administrator has also
 been notified.  The error details if available are as follows:
#CFCATCH.Detail#

Please wait for the administrator to address the error and respond to you before using
 the system again.
                </cfmail>
           </cfcatch>
        </cftry>

       <!--- send e-mail to user confirming the completion of the job --->
       <cfmail from="#CFEvent.Data.adminE-mail#" to="#CFEvent.Data.user?	
	   			E-mail#" 
				subject="E-Mail Blast Process Complete" 
				mimeattach="#CFEvent.Data.logFilePath##logFileName#">
Your e-mail blast was sent successfully.  The total time for the blast was #totalTime#
 seconds.

Attached is a log file containing a list of all the e-mail addresses to which the e-mail
 was successfully sent.  You may also view these log files from the i2 Central
  administration tools.
        </cfmail>
    </cffunction>
</cfcomponent>