CGI Scripting

Using the mailto Script
Options

EarthLink's mailto script has many more features in addition to the ones you are already familiar with. We will cover these features on this page in a FAQ format.

Can I change the return email address from mailto_cgi@cgibuilder.com to something else?
Can I change the default subject of the data that is emailed to me?
Is it possible to have data from my form sent to multiple email adddresses?
How can I make my fields required?
What other error-checking directives are available with the mailto script?
What order are the fields emailed in?
Can I have multiple error-checking directives for a single field?
Can I specify more than one field per CHECK directive?


Can I change the return email address from mailto_cgi@cgibuilder.com to something else?

Yes, this can be accomplished by using the FROMADDRESS hidden field.

<INPUT TYPE="HIDDEN" NAME="FROMADDRESS" VALUE="user@domain.com">

where user@domain.com is the email address you want to use.

You may also wish to use the FROMADDRESS field as a non-HIDDEN type so that users of your form can enter in their email address and that would show up on the message that you will receive. Here's an example

Email Address:
<INPUT TYPE="TEXT" NAME="FROMADDRESS" SIZE="20">

Can I change the default subject of the data that is emailed to me?

Yes, you can change the subject by using the SUBJECT hidden field.

Example:

<INPUT TYPE="HIDDEN" NAME="SUBJECT" VALUE="Data From Form">

Replace "Data From Form" with the subject you want to use. You may also wish to unhide the SUBJECT field and allow your users to enter the subject if you want.

Is it possible to have data from my form sent to multiple email adddresses?

Yes, you can send data from your form to multiple email addresses by entering in multiple email addresses as the value of the hidden field RECIPIENT separated by commas.

Example:

<INPUT TYPE="HIDDEN" NAME="RECIPIENT" VALUE="user1@domain.com,user2@domain.com,user3@domain.com">

where user1@domain.com, user2@domain.com and user3@domain.com are the addresses where you want data to be sent to.

How can I make my fields required?

Fields can be made required by using the NOTBLANK error-checking directive.

Example:

<INPUT TYPE="HIDDEN" NAME="CHECK:NOTBLANK:Field_Name">

replacing Field_Name with the name of the field you want to be filled out before a user can submit a form. To use the above mentioned error-checking directive with multiple fields, you can separate the field names with commas.

Example:

<INPUT TYPE="HIDDEN" NAME="CHECK:NOTBLANK:First_Name,Last_Name,Email_Address">

where First_Name, Last_Name and Email_Address are the names of the fields.

What other error-checking directives are available with the mailto script?

Here is a list of other error-checking directives and an explanation of each one of them.

<INPUT TYPE="HIDDEN" NAME="CHECK:EMAIL:Email_Address">
<INPUT TYPE="HIDDEN" NAME="CHECK:PHONE:Phone_Number">
<INPUT TYPE="HIDDEN" NAME="CHECK:ZIP:ZIP_code">
<INPUT TYPE="HIDDEN" NAME="CHECK:NONUM:Name">
<INPUT TYPE="HIDDEN" NAME="CHECK:NOLETTER:Age_Range">
<INPUT TYPE="HIDDEN" NAME="CHECK:NUMONLY:Favorite_Number">
<INPUT TYPE="HIDDEN" NAME="CHECK:LETTERONLY:State">
<INPUT TYPE="HIDDEN" NAME="CHECK:SELECT:Product" Value="Select a Product">

Explanation:

<INPUT TYPE="HIDDEN" NAME="CHECK:EMAIL:Email_Address">

checks the value entered for the field name Email_Address and makes sure that it is in proper email address format. If it is not, then the script will notify the user.

<INPUT TYPE="HIDDEN" NAME="CHECK:PHONE:Phone_Number">

verifies that the value entered for the field Phone_Number is a valid US telephone number format. This is the format that the script will check for

[3 digit area code] [3 digit prefix] [4 digit number] Ext. [optional 2-6 digit extension]

Sample: 999 999 9999 Ext. 211 or (999) 999-9999 Ext. 211

<INPUT TYPE="HIDDEN" NAME="CHECK:ZIP:ZIP_Code">

verifies that the value entered for the field ZIP_Code is a valid US zip code. The script currently understands the simple 5 digit zip code plus the simple + 4 digit zip codes (Example: 99999-9999).

<INPUT TYPE="HIDDEN" NAME="CHECK:NOLETTER:Age">

verifies that the value entered for the field Age does not contain any letters. All other characters are allowed.

<INPUT TYPE="HIDDEN" NAME="CHECK:NUMONLY:Favorite_Number">

verifies that the value entered for the field Favorite_Number contains numbers only.

<INPUT TYPE="HIDDEN" NAME="CHECK:LETTERONLY:State">

verifies that the value entered for the field State contains only letters.

<INPUT TYPE="HIDDEN" NAME="CHECK:SELECT:Product" Value="Select a Product">

verifies that the value selected for the field Product is not the same as what you specify in the Value. For the above line, if a user leaves the value of the field Product as "Select a Product", the script will notify the user to select a different value.

What order are the fields emailed in?

When you receive data from your forms, the fields are in the exact same order as they appear in the form. If you wish to change the order of the fields coming from the form, then you may prepend numbers like 0-Field_Name1, 1-Field_Name2, 3-Field_Name3... on the field names and add this email-formatting directive on your form

<INPUT TYPE="HIDDEN" NAME="ALPHA_SORT" VALUE="">

Can I have multiple error-checking directives for a single field?

Yes. We'll illustrate this with an example. Let's make a field called Email required and have the script verify that it is in the proper email address format.

Email Address:
<INPUT TYPE="TEXT" NAME="Email" SIZE="20">
<INPUT TYPE="HIDDEN" NAME="CHECK:NOTBLANK:Email">
<INPUT TYPE="HIDDEN" NAME="CHECK:EMAIL:Email">

Can I specify more than one field per CHECK directive?

Yes you can, except for the SELECT directive. Here's an example that makes the fields First_Name, Last_Name and Email_Address required.

<INPUT TYPE="HIDDEN" NAME="CHECK:NOTBLANK:First_Name,Last_Name,Email_Address">

 

Other Related Pages

Forms Menu
Mailto Script Basics
Confirmation Page
Putting It All Together
Frequently Asked Questions



Member Web Support Main Menu