How to configure FormMail?
IMPORTANT!: this functionality has been deprecated and it's not active anymore. In order to send emails using a form on a non PHP plan, you can use any external service, for example MailThisTo, FormsPark or MailSlurp
Form Configuration:
The action of your form needs to point to this script, and the method should be POST or GET in caps. The 1.5 version of FormMail offers many new ways to codify your form and adapt it to the HTML page that results anf the way that the scripts works. Below is a list of form fields you can use and how to implement them.
Direction to CGI FormMail: /cgi-sys/form-mail.cgi
Necessary form fields:**
There is only one field that you need to have, this is the recipient.
Field: recipient_
- Description: This form field allows you to specify to who you want to send by e-mail the results of the form. Probably you want to configure this option like an hidden form field with a value equal to your e-mail address.
- Syntax:
<input type=hidden name="recipient" value="email@your.host.com" />
Optionality form fields:**
Field: subject_
- Description: The subject field allows you to specify the subject you want that appears in the e-mail that is send when someone fill in the form. If you don't want to activate this option, the script will send the message with this subject: WWW Form Submission.
- Syntax: If you want to indicate the subject:
<input type=hidden name="subject" value="Your Subject" />
To allow the user choice the subject:<input type=text name="subject" />
Campo: email_
- Description: This form field allows you to specify an e-mail direction. If you want to sent e-mail responses to the user, is highly recommended to include this form field and allow to fill it. This field will be indicated in the field From: of the message that you will receive. If you want to check the Syntax of the mail direction to force that it is valid, you will have to add this field name int the required fields.
- Syntax:
<input type=text name="email" />
Field: realname_
- Description: This field allows the client to introduce his real name. This field is useful for identifiable purposes, and a it will be also included in the From: line of your header message.
- Syntax:
<input type=text name="realname" />
Field: redirect_
- Description: If you want to redirect the user to a different URL, rather than let him see the default response of the completed form, ypu can use this hidden variable to send him to an previously created HTML page.
- Syntax: To choose the URL direction that it will be redirected:
<input type=hidden name="redirect" value="http://your.host.com/to/file.html" />
To allow you to specify a URL to access once the form is completed:<input type=text name="redirect" />
Field: required_
- Version: 1.3 & higher
- Description: You can require that certain fields of the form are filled before the user sends this form with success. Simply you have to indicate in this field, all the fields that are mandatory. If the mandatory fields aren't filled, the user will be notified to fill them. To use a personalized error page see 'missing_fields_redirect'
- Syntax: If you want that the e-mail and telephon fields and mandatory, so you can contact with them when you receive the e-mail, you can use a syntax like this:
<input type=hidden name="required" value="email,phone" />
Field: env_report_
- Versión: 1.3 & higher
- Description: It allows you to have environment variab les included in the e-mail message that you will receive after that one user has filled the form. Its useful if you want to know the browser that they are using, from which domain they have accessed or any other attribute associated with the environment variables. The next is a short valid environment variables list that can be useful:
- REMOTE_HOST Send the hostname doing a question.
- REMOTE_ADDR Send the remote host's IP address doing a question.
- REMOTE_USER If the server uses authentication and the script is protected, this is the username that has been logged. * Usually not displayed .*
- HTTP_USER_AGENT The browser used by the client send the form.
There are others, but these are a few of the most useful. For more information on environment variables, see: http://www.cgi-resources.com/Documentation/Environment_Variables/ - Syntax: If you want to find the remote host and browser that sends the form, you must indicate the following:
<input type=hidden name="env_report" value="REMOTE_HOST, HTTP_USER_AGENT" />
Field: sort_
- Version: 1.4 & higher
- Description: This field allows you to choose the order of the variables that you want that appears in the e-mail that the FormMail generates. You can get the fields sorted alphabetically or set the sort of the fields in your e-mail that you want that appears. Leaving this field empty, the sort will simply be the sort that the browsers send the information to the script by default (is usually the same order they appear in the form). To set the sort of the fields you must include the phrase "order:" as the first part of the value of the chosen field, and then continue with the names of the fields that you want to be listed in the e-mail message, separated by coma. The version 1.6 allows little more flexibility when listing the fields to sort, so as to include spaces and line breaks in the field without them interfering with the order. This is useful when there are many form fields and need to insert a separator line.
- Syntax: To sort alphabetically:
<input type=hidden name="sort" value="alphabetic" />
To sort by a set of fields:<input type=hidden name="sort" value="order:name1,name2, name3,etc..." />
Field: print_config_
- Version: 1.5 & higher
- Description: print_config allows you to specify the variables that you want to be printed in your e-mail message. By default, no one config field is printed in the e-mail. This is so because the important forms field , like email, subject, ... are included in the header of the message. Anyway, some users have asked for this option, so they can have these fields printed in the message body. The config fields that you can have printed will be in the value attribute of input tag separated by commas.
- Syntax: If you want to print the email and subject fields in the message body, you have to put the following form tag:
<input type=hidden name="print_config" value="email,subject" />
Field: print_blank_fields_
- Version: 1.6
- Description: print_blank_fields allows you to ensure that the form fields are printed in the returning HTML, unless it had not been completed. By default, FormMail leave this property off, so that unused form fields are not sent.
- Syntaxy: If you want to print all blank fields:
<input type=hidden name="print_blank_fields" value="1" />
Field: title_
- Version: 1.3 & higher
- Description: This form field allows you to specify the title and header that will appear in the resulting page if you do not specify a URL in the redirect field.
- Syntax: If you want a 'Feedback Form Results' title:
<input type=hidden name="title" value="Feedback Form Results" />
Field: return_link_url_
- Version: 1.3 & higher
- Description: This field allows you to specify a URL that appears, as return_link_title, in the following report page.This field is not used if the redirect field have indicated, but is useful if you allow the user to receive the report at the next page, and want to offer a way back to the home page.
- Syntax:
<input type=hidden name="return_link_url" value="http://your.host.com/main.html" />
Field: return_link_title_
- Version: 1.3 & higher
- Description: This is the title that will used to send back the user to the page you specify with return_link_url. The two fields will be displayed in the resulting form page as: return_link_title
- Syntax:
<input type=hidden name="return_link_title" value="Back to Main Page" />
j
Field: missing_fields_redirect_
- Version: 1.6
- Description: This form field allows you to specify a URL that users will be redirected if mandatory fields are not filled. So you can customize an error page instead of displaying the default page.
- Syntax:
<input type=hidden name="missing_fields_redirect" value="http://your.host.com/error.html" />
Field: background_
- Version: 1.3 & higher
- Description: This form field allow you to specify a background image that will appear if you do not have the redirect field. This image will appear as a background to the form results page.
- Syntax:
<input type=hidden name="background" value="http://your.host.com/image.gif" />
Field: bgcolor_
- Version: 1.3 & higher
- Description: This form field allows you to specify a bgcolor for the form results page in the same way you specify a background image. This field will not work if the redirect field is indicated.
- Syntax: For a white background color:
<input type=hidden name="bgcolor" value="#FFFFFF" />
Field: text_color_
- Version: 1.3 & higher
- Description: This field works the same way as bgcolor, and change the text color.
- Syntax: For a black text color:
<input type=hidden name="text_color" value="#000000" />
Field: link_color_
- Version: 1.3 & higher
- Description: Change the color of the links on the results page. It works the in he same way that text_color. It will not be used if the redirect field is set.
- Sintaxis: For a red link color :
<input type=hidden name="link_color" value="#FF0000" />
Field: vlink_color_
- Version: 1.3 & higher
- Description: Change the color of visited links on the results page. Functions like the link_color. It will not be used if the redirect field is set.
- Sintaxis: For a blue visited link color:
<input type=hidden name="vlink_color" value="#0000FF" />
Field: alink_color_
- Version: 1.4 & higher
- Description: Change the color of active links in the results page. Functions like the link_color. It will not be used if the redirect field is set.
- Sintaxis: For a blue active link color:
<input type=hidden name="alink_color" value="#0000FF" />
Any other form field to appear in your script will be sent back and displayed on the page if you do not have the redirect field set. There is no limit on other form fields taht you can use with this form, except the limits imposed by browsers and your own servers.
Example code:
<html>
<head>
<title>Example form;/title>
</head>
<body>
<form action="/cgi-sys/form-mail.cgi" method="post">
<p style="text-align: center;">
Name: <input name="name" size="20" /><br />
Company: <input name="company" size="20" />
</p>
<input type="submit" value="Send" name="B1" />
<input type="hidden" value="direction@destination.com" name="recipient" />
<input type="hidden" value="http://www.domain.com/formok.htm" name="redirect" />
<input type="hidden" value="Form send by WEB" name="subject" />
</form>
</body>
</html>