Ranson's Scripts MailForm Help

For Unix or NT

MailForm will send mail to you from any form you design. The form may be designed any way you like, with any combination of field types. There are a few tags (see below) that must be present in your form for the program to send mail to you. See the example form.

Input tags you may use:

Installation of mailform.pl

  1. Place the mailform.pl and SendMail.pm in your cgi-bin or any folder where you can run CGI Programs.
    For Unix systems, chmod mailform.pl to 755.
  2. Change the <FORM ACTION=" http://www.yourserver.com/mailform.pl "> tag on your form, to indicate the web address for the mailform.pl.
  3. Design your form to fit your site and specific form needs.
On a Unix System if when running the mailform.pl you get a Server Error most likely the first line of the script is incorrect for your server.
#!/usr/bin/perl
Ask your server administrator for the correct path to perl for the server. We can not help with this.

If you get a Referer Error you will need to set the referer in the mailform.pl script. The help for setting the referer is in the mailform.pl


Designing your Form

In your HTML Form there are tags that must be present in the form for the program to send mail to you.
Note: The fields that start with XX- CAN NOT be changed and must be exactly as shown below.

Hidden Tag Names CAN NOT be changed!

The special hidden tags MUST be exactly as shown below in your form. The "names" are case sensitive.

Hidden tags that must be present

For any Windows Operating System, these tags must be present
XX_OS = the operating system of your server
XX_SMTP = the mail server to use for windows
XX_debug = debuging windows mail If you are having trouble with the windows mail set the debug to 1   this will give you some information on what is happening with the mail server.

<input type="Hidden" name="XX-OS" value="windows">
<input type="Hidden" name="XX-SMPT" value="smtp.dtccom.net">
<input type="Hidden" name="XX-debug" value="0">

For any Unix type Operating System (linux), this tags must be present
<input type="Hidden" name="XX-OS" value="unix">
<input type="Hidden" name="XX-MailProgram" value="/usr/sbin/sendmail">


The mail Subject
<input type="Hidden" name="XX-subject" value="My Mail Subject">
Who to send the E-Mail to
<input type="Hidden" name="XX-send-to-email" value="you@your-server.com">
To Sort or not to Sort
<input type="Hidden" name="XX-sort" value="yes"> or value="no"


Optional Hidden tags

Setting Up Required Fields (optional)
<input type="Hidden" name="REQUIRED" value="name,XX-email,Comments">

To make a form field Required to be filled in by the user use the tag above in your form. To define which fields you want to require, put the name of the field
( name for the users Name Field )
in the Value="name" portion of the REQUIRED tag. To Require more than one field, place a comma (,) between the fields you want to require.
Example - value="name,XX-email,Comments" will require the users Name, users E-Mail, and Comments.
Important: Use only one REQUIRED tag in your form.

Setting Up Sort Order (optional)
<input type="Hidden" name="XX-Sort_Order" value="name,XX-email,address,city,state,zip,comments">

To sort the fields in a certain order use the hidden tag above. Enter the names of the fields in the order you want them to appear in the email.
Use a comma between the fields in the value tag.
Important: if you are using the sort order hidden tag,
all of your form fields MUST be listed in the Value="" of the XX-Sort_Order tag.

EXAMPLE: value="name,XX-email,address,city,state,zip,comments" In this example the order of the fields would be:
name
email
address
city
state
zip
comments

Redirection the user to ?
<input type="Hidden" name="XX-redirect-to-url" value="http://www.rlaj.com">

Using this tag in the form, you can "redirect" the user to another page after they have filled in your form. If you do not use this tag, the user will see a "Thank You" screen after the form is submitted.

Attaching a file to the email

You can attach a file to the email using the tags below.
<input type="Hidden" name="XX-attach_file" value="complete/path/to/file.html">
<input type="Hidden" name="XX-attach_file_name" value="mailform.htm">

XX-attach_file is the complete path to the file you want to attach.
XX-attach_file_name is the name of the file.

Important Information for Attachments
On Unix Systems you can send any type of file, .zip .pdf .html etc.
<input type="Hidden" name="XX-attach_file" value="/home/httpd/html/mysite/mailform/mailform.htm">
<input type="Hidden" name="XX-attach_file_name" value="mailform.htm">

On Windows Systems you can send only text files that appear as part of the body of the email, .txt .html etc.
YOU CAN NOT SEND ZIP OR COMPRESSED FILES.
<input type="Hidden" name="XX-attach_file" value="c:\website\wsdocs\mailform\mailform.htm">
<input type="Hidden" name="XX-attach_file_name" value="mailform.htm">







Example Form HTML Code

Example Form

* Your Name

* E-Mail Address

* Address

* City

* State

* Post Code

* Message
*

 

MailForm - © 1999 Ranson's Scripts



Example Form Code

<html>
<head>
<title>Mail Form</title>
</head>
<BODY BGCOLOR="#FFFFF1">
<center>
<h2>Send your questions or comments</h2>
</center>
<form method="POST" action="mailform.pl">
<input type="Hidden" name="XX-OS" value="windows">
<input type="Hidden" name="XX-SMPT" value="smtp.dtccom.net">
<input type="Hidden" name="XX-debug" value="0">
<!input type="Hidden" name="XX-MailProgram" value="/usr/sbin/sendmail">

<input type="Hidden" name="XX-attach_file" value="c:\website\wsdocs\mailform\mailform.htm">
<input type="Hidden" name="XX-attach_file_name" value="mailform.htm">

<input type="Hidden" name="XX-subject" value="Mail Subject">
<input type="Hidden" name="XX-send-to-email" value="you@your_server.com">
<!input type="Hidden" name="XX-redirect-to-url" value="http://www.rlaj.com">
<!input type="Hidden" name="REQUIRED" value="name,XX-email,Comments">
<input type="Hidden" name="XX-sort" value="no">
<!input type="Hidden" name="XX-Sort_Order" value="name,XX-email,address,city,state,zip,comments"> 
* Your Name
<BR>
<input type=text name="name" size=40>
<p>
* E-Mail Address
<BR>
<input type=text name="XX-email" size=40>
<p>
* Address
<BR>
<input type=text name="address" size=40>
<p>
* City
<BR>
<input type=text name="city" size=40>
<p>
* State
<BR>
<input type=text name="state" size=40>
<p>
* Post Code
<BR>
<input type=text name="zip" size=40>
<p>
*  Message 

<BR>
<textarea name="Comments" WRAP=physical COLS=50 ROWS=10></textarea>
*  
<input type="submit" value=" Send Mail ">
</form>
<P>
 
<P>
<CENTER>MailForm - © 1999/2000 <A HREF="http://www.rlaj.com/scripts">Ranson's Scripts</A></CENTER>
<HR Width=90%>
<HR Width=50%>
<HR Width=10%>
  </body>
</html>