Home On-line Data Access FAQ Software Download
Documentation EPIC Contacts What's New Site Map
EPIC Programs Database Management EPIC I/O Library Matlab MexEPS
Web Utilities X-Motif Interface PPLUS Graphic Package Java

EPIC Web Utilities -- Email contact form (For local, internal PMEL use)


The email contact form is a WWW CGI FORM program which can be used for a webpage contact, comment or feedback form. The user of the web page enters their email address, a subject line, and text comments into a form on the web page. The utility sends the comment/feedback email to a list of recipients.

The utililty was written to avoid putting contact email addresses on a web page and to ease the implementation of a web form which enables user feedback from a web page. The feedback and response web pages must be created by the web page developer.


Quick Start:

  1. Install this example code (MS Word format) into your web page to create the FORM. Note that the fields in red in this document must be modified for your individual application. The FORM will look the same as the one at the bottom of this web page: http://www.epic.noaa.gov/epic/software/dapper/
  2. Create a response page URL web page, which might resemble this example: http://www.epic.noaa.gov/epic/software/dapper/contact.html
  3. Contact Eugene Burger with the following information: 1) the email addresses the comments/feedback should be sent to, 2) the form id that you used in your form (red in the example code) and 3) the response page URL that the user will be directed to once the comments/feedback have been send in email to the recipients.

Advantages of using this utility:

The feedback form remailer utility allows a web page creator to reuse code and infrastructure to implement a secure comment web form on their web page. It was written to avoid putting contact email addresses on a web page and to ease the implementation of a web form which enables user feedback from a web page. Some advantages of the feedback form remailer utililty are:

  • Your web page will have no e-mail address that can be harvested by spammers.
  • User input is verified as to ensure the minimum information is entered (sender's e-mail address)
  • Possible malicious code in the input fields is escaped as to render it harmless.
  • Reduces the chances that you will be spammed through this script since the script is only executable by noaa.gov hosted pages.
  • If you decide to use the remailer in multiple web pages, the email that you receive from the remailer identifies the site it was sent from.
  • There is a built-in capability for the script to prompt the user with an error message if some required field is not filled in or some error occurs while processing the user input.
  • You can see the utility installed on the NOAA El Nino page, which is hosted on a PMEL web server. Scroll to the bottom and click on "Contact us" in the footer to see the form.

Feedback page fields

The feedback form can have up to eight form elements, of which 4 are required. The form input will be rejected if any one of these four elements are missing:

  • Three visible form fields
    • Email address entry field
      • field name: senderEmail
      • typically element type text field
    • Subject entry field
      • field name: senderSubject
      • typically element type text field
    • Feedback text area
      • field name: senderText
      • typically element type text area
  • One hidden form element.
    • The form identifier
      • field name: formID
      • This identifier can be numeric, or text, although text is preferable as the value of this field is used to identify the source page

The remaining four elements are optional form elements, and can be any type of form element. Simply add these elements to the form, and set the name element attributes to userField1 through userField4.

Configuration database

Give the following information to Eugene Burger (eugene.burger@noaa.gov). This information will be entered into the database and used by the feedback remailer

  • The e-mail address(es) the feedback has to be sent to. There is no limit to the number of addresses you can send to, but it is recommended that a distribution address is set up with CNSD.
  • The form identifier, which will be used to identify the source page in your e-mail responses.
  • The response page URL. This is the page the user will be redirected to once the users feedback has been sent to the addres(es) you provided.
  • Script URL The "action" attribute of your feedback form has to point to http://plover.pmel.noaa.gov/phputil/feedbackremailer.php

Response page

Error messages, if any, are returned to the response page. Variable and values are:

  • errorEml
    • 1 - invalid e-mail address
    • 2 - No e-mail address entered
  • errorSubject
    • 1 - Subject text to long
  • errorTxt
    • 1 - Text to long

Form data tests

Are four primary form fields in the sender form?
On error:
Redirect to PMEL homepage

Does the form ID field exceed 25 characters in length?
On error:
Reject input and redirect to PMEL homepage.

Is the form ID a valid id (present in DB)
On error:
Reject input and redirect to PMEL homepage.

Is e-mail address entered, and in the correct form?
On error:
Redirect to response page with error code.

Does the subject text length exceed 200 characters?
On error:
Truncate subject text and send error code to response page.

Does the feedback text exceed 2000 characters?
On error:
Truncate feedback text and send error code to response page.

If you have any questions about email contact utility please contact: epic@noaa.gov or Eugene Burger (the author).