1 Reply Latest reply on Jun 4, 2015 12:36 PM by BKBK

    Using and accessing session variable

    myCharlie Level 1

      I have found this page, Adobe ColdFusion 9 * Configuring and using session variables, but I do not know if the way I'm using is correct. In the contact us page, I set the session variable to 1 (for yes the user has turned off java script). In the submission-success.cfm, I tried this:

      <cfif #session.EmailSuccess# eq 1>

        <cfif (form.mailto is not "" AND form.mailfrom is not "" AND form.message is not "" AND form.name is not "")>

        <cfset session.myweb.email.success = "true">

        <cfmail to = "#form.mailto#" from = "#form.mailfrom#" subject = "Inquiry from Contact Us Form by #form.name#" server="smtp.myweb.com" port="25" type="html">

        <cfoutput>

        <p>This message was sent by an automatic mailer by #form.name#:</p>

        <p>= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =<p>

        <p>#form.message#</p>

        <p><cfif structkeyexists(form, "phone")>Phone: #form.phone#</cfif></p>

        </cfoutput>

        </cfmail>

        <cfelse>

        <cfset session.uwec.email.success="false"> 

        <cfset session.uwec.email.failmsg="Please Submit with reCaptcha">

        </cfif>

      </cfif>

       

      The email was never sent. Any suggestion is much appreciated.