Example Number 5.1

Example Name: SendEmail.cfm

Language: CFML

Version: 1.0.0

Code:

<cftry>
  <cfmail to=flash.toAddress 
   from=flash.fromAddress
   subject=flash.subject
   server="mail.yourserver.com">
#flash.body#
  </cfmail>
  <cfcatch type="Any">
    <cfset Flash.result = "There was an error">
    <cfabort>
  </cfcatch>
</cftry>
<cfset Flash.result = "Email sent">

Download code text

Download chapter example files