<!--- Set up IMAP email configuration for our FailTo address. NOTE: This is a GMail hosted email account so we will be able to use the PLUS (+) addressing in the email addresses. NOTE: Since this is using secure IMAP features, this part of the code is only available for ColdFusion 9. ---> <cfset imapSettings = { server="imap.gmail.com", username="coldfusion@bennadel.com", password="***********************", port="993", secure="true" } /> <!--- Get the headers from the FailTo account. ---> <cfimap name="headers" action="getheaderonly" attributecollection="#imapSettings#" /> <!--- Loop over the headers looking for one that contains a plus-style addressing - this will be our FailTo emails. ---> <cfloop query="headers"> <!--- Check for the plus. ---> <cfif find( "+", headers.to )> <!--- Output the customer ID - this will be the part of the email address that is between the + and the @ sybols. ---> <cfoutput> Customer ID: #listGetAt( headers.to, 2, "+@" )# </cfoutput> </cfif> </cfloop>