Accessibility

TechNote (Archived)

How to get data from a form into an e-mail

Dreamweaver does not include server behaviors for passing form data into an email. However, there are several methods of getting information from a submitted form into an e-mail.

Methods for passing form data into an email response
Use a Common Gateway Interface (CGI) script

A CGI script works with the form to gather the data, parse it, and insert it into an e-mail. Your server administrator may have a CGI script on the server that will process your data. If not, there are many CGI scripts available for free on the Internet. If you use one of these scripts, it has to be uploaded to your server and may have to be placed into a cgi-bin folder. Talk to your server administrator to find out where the CGI script needs to reside on the server.

It is a good idea to create a parallel folder structure in your local root folder, including the folder named cgi-bin. This allows you to browse to the CGI script locally when linking to it from your form and ensures that the path to the CGI script will work correctly when you upload your site.

Use a Scripting language

Active Server Pages (ASP), JavaServer Pages (JSP), ColdFusion (CF), and PHP (PHP: Hypertext Preprocessor) are server-side scripting languages used to pass data to and from a database, and these languages can also be used to pass form data into an email. As mentioned above, Dreamweaver does not include server behaviors for passing form data into emails.

There are extensions available from the Dreamweaver Exchange which add this functionality as server behaviors into Dreamweaver. Search for the words "form" and "email" from the Exchange Search page to find all results.

Use a remotely-hosted form-to-email service

This service acts as the processor of the form data. The Action of the form points to their remote CGI script. Their script processes the data, then sends the data to a specified e-mail address.

The remotely-hosted service will have access to the data collected from the form.

Define the form's Action to be a mailto: link

While this is the easiest method for e-mailing form data, it is not recommended because not all browsers recognize an e-mail address as a form's Action. Furthermore, even if the browser accepts this attribute, the user's system and mail configuration may prevent this strategy from working. When it fails, it can fail invisibly, so neither the user nor the intended recipient will know that the form data was not sent.

Setting up a simple mailto form in Dreamweaver

Once a form has been developed in Dreamweaver, follow the steps below to create a mailto action for the form. Refer to How to develop a form in Dreamweaver (TechNote 14950) if you need additional information about creating the form itself.

  1. In Design View, place the cursor inside the form, then select the form tag from the Tag Selector at the bottom of the page.
  2. In the Action field of the Property inspector, enter the e-mail address where the data in the form will be sent to. If you are using another method for processing the form data, the action field will typically refer to a file that houses the processing script.
  3. In the Enctyp field, type text/plain.
  4. A subject line can be defined by adding it after the email address and a question mark in the Action field. An example of that would be: mailto:user@domain.com?subject=Hello there.
Additional information

For more details on working with forms, see How to develop a form in Dreamweaver (TechNote 14950) or one of the following sites:

Forms
CGI Scripts
ASP

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_14853
Browser:Chrome
Internet Explorer
Netscape
Opera
Safari
Firefox

Products Affected: