• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using and accessing session variable

Explorer ,
Jun 04, 2015 Jun 04, 2015

Copy link to clipboard

Copied

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.

Views

387

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2015 Jun 04, 2015

Copy link to clipboard

Copied

LATEST

You could simply check whether the conditions for sending e-mail were met. You could do so by placing the following underneath your code block:

<p>Check:</p>

session.emailSuccess = <cfoutput>#session.emailSuccess#</cfoutput><br>

<cfdump var="#form#" label="form">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation