It's really easy, actually, but we're going to go over the basics before we get into the specifics.
Let's conjure up a simple example. You have a website, you want your website visitor to fill out a form, click on submit, have the content of the form that they filled out be sent to you via e-mail, and you'd like to thank them for their time.
For the purposes of this example, we'll separate that into three parts:
- The form
- The processing script
- The thank you page.
How do you create an HTML form? That's really beyond the scope of this article, but we'll touch on some of the key components. For more information, w3schools.com has some great resources you can use for HTML Forms and Input.
The basic anatomy of a form looks like this:
- OPEN FORM TAG
- FORM FIELD
- SUBMIT BUTTON
- CLOSE FORM TAG
Here's an example of what it looks like in action.
You'll notice that the form tag has an attribute called "action", and another called "method". For our example, the action will name your processing script, and the method will be "post", because you are going to transmit your form field variables to the processing script page using a request method called HTTP POST. No, you don't have to know how it works, you just need to be able to type method="post". Not hard, is it?
So let's assume that you have built your form, you have pointed it to the right place (the name of your processing script, just make it with a text editor and ensure you save it with the CFM extension, so the Cold Fusion server will process it) and have set your FORM to send the information using the POST method.
THE PROCESSING SCRIPT
The Adobe LiveDocs CFMAIL pages have far more extensive details, but we'll cover the basics here.
Your very basic processing script will simply have a <CFMAIL> tag and a <CFLOCATION> tag. The first composes and sends the e-mail, and the second will push the browser to your thank you page.