Search code examples
htmlcoldfusioncfmail

ColdFusion written in html page


I'm very new to ColdFusion (this is my second day dealing with it) and I am implementing a simple HTML page. I have a feedback form on this page and when the user hits submit, I want to email the contents of the form to myself. I have to do it using cfmail.

To try it out before I implemented it, I created the following cfmail.cfm file:

<cfmail from="#form.from#" to="myemailaddress" type="html">
    Some text
</cfmail>

and passed the name of the file to the action attribute of my form. Every time I click submit on my form, it just opens the above file.

All the examples I find online pretty much show the same thing, but obviously I'm way off here.

Am I using cfmail in the wrong manner?

Thanks in advance for your help!


Solution

  • Just like Evik said in the comments, add a subject because it is a required field for the cfmail tag.

    <cfmail to="#form.mailto#" from="#form.mailFrom#" subject="#form.subject#">
      #form.body#
    </cfmail>
    

    Also check the mail settings in the ColdFusion administrator under Setting > Mail. There is also a mail log in the administrator you can check.

    I recommend using Adobe online docs for ColdFusion. I referrer to it almost daily, they are great.

    Here is a link to the cfmail for CF8 but at the bottom it links to other version.

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_m-o_01.html