1

I'm using commonspot, and I'm new to it. I have written a code for referring a page to a friend using cfmail. But it is not working, can you please tell me what all i have to do ?

my refer.cfm page

<title>E-Mail this page to your friend</title>

<cfoutput>

<cfform method="post" name="Emailform" action="sendmail.cfm"> 
<table border="0" cellspacing="0" cellpadding="4" width="90%" id="ContactMe">
<tr> 
<td width="30%"><div align="right">Your Name:</div></td> 
<td width="70%"><input type="text" name="name" size="30" /></td> 

<tr> 
<td><div align="right">Friend Email:</div></td> 
<td><input type="text" name="email" size="30" /></td> 

 <tr> 
<td>&nbsp;</td> 
<td> 
<input type="submit" id="submit" name="submit" value="Submit" /> 
<input type="reset" name="reset" value="Reset" /> 
</td>
</table></cfform></cfoutput>

my sendmail.cfm file:

<cfoutput>
<cfmail to="#email#"
from="do-not-reply@balah balah.com"
subject="#form.name# has referred you a page"
type="html">
Dear #form.name#
blah blah
</cfmail>
<p>Your E-Mail has been sent.</p>
</cfoutput>

did I do anything wrong? or did i miss anything?

thank you

ale
  • 6,369
  • 7
  • 55
  • 65
  • Please explain what you mean by "it's not working ". Does it error? Does the email send but not arrive? – Stephen Moretti Apr 15 '12 at 18:09
  • the error is: we are sorry the page you requested is experiencing a problem at this time. please try again soon. –  Apr 15 '12 at 19:12

1 Answers1

1

If the cfmail call actually has a from address of "do-not-reply@balah balah.com" then it will error due to the space in the email address. If not then you will need to figure out what error is occurring. Wrap your code with the following:

<cftry>
<!--- cfmail code here --->
<cfcatch><cfdump var="#cfcatch#" /><cfabort /></cfcatch>
</cftry>

I'm not sure from your questions and comments whether the browser is outputting a "nice" error or if you have a custom error message but this try/catch should get around it either way.

Dan Roberts
  • 4,664
  • 3
  • 34
  • 43