From an HTML Form to an Email Inbox

Getting the html form data in the email inbox will be a very convenient way to collect user responses very quickly. Except, when you have hundreds of responses per day! Here are the methods you have to get the html form data in your email inbox.

One quick and simple method is to use the 'mailto:you@yourdomain.com' in the 'action' field of the form. This method is very simple; but has many drawbacks.
See the article: Can JavaScript Email a Form?

Using a Formmail Script

A formmail script is a server side script that gathers the data submitted in the form and mails it to a given email address.

There are many formmail scripts available.

The following section describes how to use a form mail script

Suppose the URL to the formmail script provided to you is http//someserver/cgi-bin/formmail.pl

give this URL in the ACTION attribute of your FORM tag
<FORM ACTION="http//someserver/cgi-bin/formmail.pl" METHOD="POST">
.....Your input elements.....
</FORM>

  • Now you can give whatever input elements you want within the form tags.

  • There are some information that you should provide to the CGI program (like the email address to which the form-data should be sent)
    provide these data as hidden fields in the form
    (using <INPUT TYPE="hidden" ......>)

  • Insert the Submit button.

  • Over! you are ready with your form.

    Example:
    The geocities.com form-mail program URL is
    http://us.geocities.yahoo.com/forms

    Let us complete the form we were using in our examples using this
    form-mail script as the form handler.

    There are some parameters required by this CGI program
    Name Description
    login your yahoo login id
    subject subject line of the mail sent to you by the formmail program
    next_url the URL of the page to be displayed after submitting this page successfully

    We will have to give these parameters as hidden fields.

    <FORM ACTION="http://us.geocities.yahoo.com/forms" METHOD="POST">

       Name: <INPUT TYPE="text" NAME="Name" VALUE="" SIZE="25" MAXLENGTH="50"> <BR>

       Email: <INPUT TYPE="text" NAME="Email" VALUE="" SIZE="25" MAXLENGTH="50"><BR>

       <INPUT TYPE="CHECKBOX" NAME="subscribe" CHECKED> Subscribe me to the News letter <BR>

       Format of the Email:<BR>
       <INPUT TYPE="radio" NAME="format" VALUE="html" CHECKED> HTML<BR>
       <INPUT TYPE="radio" NAME="format" VALUE="text"> Plain Text<BR>

       Type of subscription you want:<BR>
       <SELECT NAME="type">  
         <OPTION VALUE="standard"> Standard - FREE
         <OPTION VALUE="prof"    > Professional - Paid
       </SELECT>    <BR>

       Comments to the editor:<BR>
       <TEXTAREA NAME="comments" ROWS="7" COLS="30"></TEXTAREA>

       <input type="hidden" name="login" value="your_yahoo_id_please">

       <input type="hidden" name="subject" value="Posted From My Form">

       <input type="hidden" name="next_url" value="http://myserver/thankyou.htm">

       <BR>
       <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Sign Me Up!">
    </FORM>

    When this form is submitted, the form-mail script sends the information submitted, to the email address corresponding to the id given in the hidden field 'login'. The mail will contain the field names and corresponding values as submitted by the user like this:
    Name: yourVisitorName
    Email: thename@server.com
    subscribe:on
    format:text
    type:standard
    comments: your site rocks!

    Back to HTML form advanced topics

    Formmail Links

    Matt's Script Archive contains a formmail script written in Perl
    http://www.scriptarchive.com/formmail.html

    Be forewarned however! You need to configure the script carefully. There are loopholes in this script that a spammer may exploit. Carefully go through the ReadMe file before installation.

    The PHP version of the formmail script is available in the following link: http://www.dtheatre.com/scripts/formmail.php

    Formmail.com offers remote hosting of the formmail script for a price. Checkout Formmail.com

    Tutorials & Articles
    HTML Form Tutorial
    Form design software
    JavaScript Form Validations
    JavaScript Form Handling
    JavaScript Button
    JavaScript Popup Windows
    The window.open method
    The window.close method
    More ...

     
    .   Copyright © 2003-2008 Simfatic Solutions. All rights reserved.