Question
ColdFusion contact form by email - please help
Hello,
I tried to create a contact form, using email to send, and I have some issues and questions:
1. I like to have a message "Your form has been sent", but it shows the blank after user submited the form.
2. If user enter her email address, this form will send to her email address and me, but it does not send to her email address.
Can anyone please take a look at my code below?
Why I don't get the output (result) I like to have?
Thanks very much.
Jenny.
<cfif IsDefined("form.Subject")>
<cfprocessingdirective suppresswhitespace="no">
<cfmail subject="#form.Subject#" from="#form.From#" to="test@test.com" >
This is a message from that form...
#form.Message#
</cfmail>
</cfprocessingdirective>
<cfelse>
<cfform action="#CGI.SCRIPT_NAME#" method="post" name="frmName">
name <cfinput type="text" name="Name" size="20"><br />
email <cfinput type="text" name="Email" size="20"><br />
Subject <cfinput type="text" name="Subject" size="20"><br />
Message <textarea name="Message" cols="30" rows="3" ></textarea><br />
<input type="submit" value="Submit it" />
</cfform>
<cfif isDefined("FORM.Name")>
<cfmail subject="#form.Subject#" from="#form.From#" to="#Email#" >
</cfif>
<cfif isDefined("FORM.Submit")>
<p>Your message has been sent</p>
<cfelse>
<cflocation addtoken="no" url="survey2.cfm">
</cfif>
I tried to create a contact form, using email to send, and I have some issues and questions:
1. I like to have a message "Your form has been sent", but it shows the blank after user submited the form.
2. If user enter her email address, this form will send to her email address and me, but it does not send to her email address.
Can anyone please take a look at my code below?
Why I don't get the output (result) I like to have?
Thanks very much.
Jenny.
<cfif IsDefined("form.Subject")>
<cfprocessingdirective suppresswhitespace="no">
<cfmail subject="#form.Subject#" from="#form.From#" to="test@test.com" >
This is a message from that form...
#form.Message#
</cfmail>
</cfprocessingdirective>
<cfelse>
<cfform action="#CGI.SCRIPT_NAME#" method="post" name="frmName">
name <cfinput type="text" name="Name" size="20"><br />
email <cfinput type="text" name="Email" size="20"><br />
Subject <cfinput type="text" name="Subject" size="20"><br />
Message <textarea name="Message" cols="30" rows="3" ></textarea><br />
<input type="submit" value="Submit it" />
</cfform>
<cfif isDefined("FORM.Name")>
<cfmail subject="#form.Subject#" from="#form.From#" to="#Email#" >
</cfif>
<cfif isDefined("FORM.Submit")>
<p>Your message has been sent</p>
<cfelse>
<cflocation addtoken="no" url="survey2.cfm">
</cfif>
