 |

Form2Mail v1.8

Email is the basic means of communications on the internet. This
program will take input from a form on a webpage and send it by email to any
email address you want.
- Freeware
- Available for servers running on Unix or Windows 95/98/NT/2000
- Supports both SMTP and sendmail
- Supports all possible form-fields
- Easy to configure and install
- Multiple configurations
- Templates are separate from the program
- Supports MIME email
- Supports X-html email
- No programming skills required
- Build-in address checker
- Written in C for optimum performance
Try Form2Mail with this fully-functional example:
Demo of Form2Mail
|
PHP
If your webserver supports the PHP scripting language then you should
really use it instead of this "Form2Mail" program, it's much more flexible.
To get you started here are
3 PHP examples ("Form2Mail.zip", 6Kb).
They basically do all the same things as "Form2Mail", but in a far more
flexible way.
For example, you can check the input before sending the email, or you can send
multiple emails.
For more information about PHP see
the PHP website.
|
Download and install
If your server is Windows 95/98/NT/2000:
- Requirements:
- You need to know the hostname of an SMTP server, and this SMTP server must
be configured to accept email from you.
Download Form2Mail-1.8.zip (69Kb)
- Unpack the zip-file into the homedirectory of your webserver,
for example "c:/inetpub/".
The intention is to make everything in the zip-file available as "/Form2Mail/*"
and "/scripts/Form2Mail.exe" to the rest of the internet.
Make sure the "c:/inetpub/scripts/" folder has "Scripts and Executables" permissions.
- Follow the directions below in the "Using Form2Mail" section.
If your server is Unix (Linux and others):
- Requirements:
- A certain minimal Unix knowledge is required. If you have
never logged on with Telnet and used the Unix commandline,
then it's unlikely you can install the program. Don't try to use the Windows
version, it simply won't work.
- You must have full cgi-bin capability on your server. Some providers do not
allow the use of cgi-bin programs, or only permit the use of scripts (PHP, PERL, etc.).
Form2Mail is a binary program, not a script.
- You must have access to the C compiler on the server.
- You must know the location of the sendmail program on the server.
Download Form2Mail-1.8.tar.gz (45Kb)
- Unpack the tar-file. There is a "html" directory and a "sources" directory.
Copy the "html" directory to the document tree of your webserver.
The intention is to make everything available to the rest of the internet,
for example "/Form2Mail/Basic/Form.html".
- Go into the sources directory and enter "make" (no parameters).
This command will start the C-compiler.
There is no need to configure anything at this stage, the program will take
all it's settings from the configuration file at run-time.
If "make" completed without errors then copy the just-created "Form2Mail.cgi"
program to your cgi-bin directory.
- Follow the directions below in the "Using Form2Mail" section.
Frequently asked questions
- Do I have a Windows or a Unix server?
- You'll have to ask your provider. The operating system of your desktop is
not relevant.
- Can I use the Windows version on a Unix server?
- No. Unix is completely different, you absolutely must compile the program
to use it on a Unix server.
- How do I execute "make"? (Unix)
- Use a Telnet program to login to the Unix server and enter "make" on the commandline.
If you have never worked with a Unix commandline before then it is unlikely
you can install the Form2Mail program.
|
Using Form2Mail
Select a sample configuration
The distribution contains 4 sample configurations in the "html/Form2Mail/" directory.
Select one of these configurations as your starting point:
- Basic
- A flexible starting point for a basic email-form.
- Expert
- The same as Basic but with more elaborate html.
- Mime
- The same as Basic but for MIME encoded email.
- X-html
- The same as Basic but for X-html encoded email.
Customize the sample configuration
Every sample configuration contains these 5 files:
- Form2Mail.cfg
- The configuration file. Form2Mail will take all it's settings from this file.
Copy it to the same directory as the Form2Mail program, the cgi-bin directory.
The contents of this file is explained in detail below, but for now just
open it in a text-editor. Make a smart guess as to what the fields should
contain and change them accordingly.
- Form.html
- The form for your users. Open the file with a text editor and find the email
address "root@foobar.com". Change it into your own email address. If you have
taken the Expert configuration then look for this email address in the
configuration file instead and change it there.
- Mail.txt
- The email that will be sent. No need to change anything at this time,
but take a look anyway. Notice the fields such as "<%macro Message%>"?
They will be replaced by values from the form.
- Result.html
- The page that will be displayed after the email has been sent. You can
customise this file later to show anything you want, as with all files of
Form2Mail, but let it be for now.
- Error.html
- The page that will be displayed when something is amiss. No need to change
anything now.
Try the program. Open the "Form.html" in your browser, enter stuff, and check if
the email is beïng sent. If all is well you can start customizing the
templates.
Adding a datafield
There are two places where you should add a datafield: in the form and in the email.
Suppose you want to add a field for the surname of the visitor. Add the following
lines to the "Form.html" and the "Mail.txt" files:
- Form.html
- <input type=text name="SurName">
- Mail.txt
- <%macro SurName%>
The Form2Mail program will receive the "Surname" field from the form, and will
replace the "SurName" macro in the email with whatever the user has entered.
You can use any name for the field you like. The "Result.html" and "Error.html"
templates also support the macro's. See the "Expert" configuration for examples
how you can use radio-butons, checkboxes, select's, and textarea's.
|
Parameters
The Form2Mail program is very flexible in accepting parameters. You can specify
parameters in the form or in the configuration file.
Form and/or configuration file
You can specify the following parameters
in the configuration file or as hidden fields in the form. Parameters in the
configuration file will override same parameters in the form.
| To |
The email address to which the email will be sent. If this parameter is
not present in the configuration file then it will be taken from the form.
For example:
Configuration: To="root@foobar.com"
Form: <input type=hidden name=To value="root@foobar.com">
|
| From |
The email address from which the email will be sent. This is for the benefit of
the receiver of the email, a reply will go to this email address.
If this parameter is not present in the configuration file then it will be
taken from the form.
For example:
Configuration: From="root@foobar.com"
Form: <input type=hidden name=From value="root@foobar.com">
|
| Mail |
The filename of the template used for the outgoïng email.
The filename may not contain the directory characters "/" or "\"
(see the "Root" parameter).
For example:
Configuration: Mail="mail.txt"
Form: <input type=hidden name=Mail value="mail.txt">
In the top of the Mail template you can specify any email headers you like,
separated from the body of the email by an empty line.
Fields in the form are available as macros', for example:
<%macro name%>
Tip: Send an email to yourself with a normal email program.
Use the received email as an example for the Mail template.
|
| Result |
The filename of the html-page that is displayed after an email has been
succesfully sent.
The filename may not contain the directory characters "/" or "\"
(see the "Root" parameter).
For example:
Configuration: Result="result.html"
Form: <input type=hidden name=Result value="result.html">
You can use macro's in the same way as in the Mail template to fetch
values from the form.
|
| Error |
The filename of the html-page that is displayed when an error occurs.
The filename may not contain the directory characters "/" or "\"
(see the "Root" parameter).
For example:
Configuration: Error="error.html"
Form: <input type=hidden name=Error value="error.html">
You can use macro's in the same way as in the Mail template to fetch
values from the form. A special macro "ErrorMessage" will contain a
short explanation of the error.
|
Form only
You can specify the following parameters as hidden fields in the form.
| Cfg |
The configuration to be used.
If not specified then the "default" configuration will be used.
The contents must refer to a configuration-section in the configuration
file, and be exactly the same as the text between "[" and "]".
For example:
<input type=hidden name=Cfg value="Example1">
|
Configuration file only
The following parameters can only be set in the configuration file.
| Root |
The root directory where the templates are stored.
You can specify a different root directory per email-configuration.
For example:
Root="d:/www/Form2Mail/Templates/"
|
| Smtp |
The domain name of the SMTP server to use for sending the email.
On Windows 95/98/NT/2000 this is a required parameter, on Unix you can
alternatively specify the Sendmail setting.
You can specify a different Smtp server per email-configuration.
For example:
Smtp="mail.foobar.com"
|
| Sendmail |
Unix only The location of the sendmail program.
It is only used if there is no "Smtp" setting present.
You can specify a different Sendmail program per email-configuration.
For example:
Sendmail="/usr/lib/sendmail"
|
|
The configuration file
Form2Mail uses a configuration file called "Form2Mail.cfg". It must be
stored in the same directory as the program itself (the cgi-bin directory).
The configuration file is a simple text file and looks like this:
[default]
Root="d:/www/Form2mail/Templates/"
Smtp="mail.foobar.com"
Error="Error.html"
[Example1]
To="root@foobar.com"
Mail="Example.txt"
Result="Result.html"
[Example2]
Root="d:/www/Questions/"
From="root@foobar.com"
Mail="MailTemplate.txt"
Result="MailResult.html"
Error="MailError.html"
[Example3]
Root="d:/www/Email/"
|
This example configuration contains the default settings and two configurations called
"Example1" and "Example2". The settings in the "default" section
are just that, the default settings for all configurations. If needed
then you can override the default settings in a configuration.
You can create as many configuration sections in this file as you need,
there is no limit to the number of configurations.
The "Example1" email will always send email to the same emailaddress,
because the "To" address is hardcoded into the configuration.
The "from" address is taken from the form. The templates are located in the
default "Root" directory, and for errors the default "Error" template.
is used.
The "Example2" email is a bit more elaborate. In this case the email
will be sent to the email address that the user specifies in the form.
The "From" address is hardcoded into the configuration.
The "Root" setting and "Error"
setting are overriden, using different values than the default.
The "Example3" email is the most flexible. Using hidden parameters in
the form you can specify which "Mail" template should be used to send
email "From" an email address "To" an email address, showing the "Result"
template when sent. In this example only the "Error" template cannot be
specified in the form, since it is hardcoded into the "default" section.
|
Known problems
- Mac users
- The configuration file must be uploaded as "text" by Mac users. The program
cannot parse the configuration file if it has been uploaded as "binary"
from a Mac. No similar problem exists for users on PC's or Unix.
- Not all data is mailed
-
The total size of all the data in the form has an upper limit, depending on the
METHOD you have used in the form. The limit is imposed by the browser of the
user, not by the Form2Mail program.
| METHOD=GET | 512 bytes |
| METHOD=POST | 131072 bytes |
- Spam protection on SMTP servers
- Many SMTP email servers will only accept email from/to a local email address.
In this case you can only use Form2Mail if either the FROM or the TO address is a
local email address, i.e. your own email address.
|
|
 |