How can a contact form look like?

This is how the code for a simple contact form can look:

1
2
3
4
5
6
7
8
9
10
<form method="post" action="/cgi-bin/FORMMAILNAME">
<input type="hidden" name="recipient" value="test@your.domain">
<input type="hidden" name="subject" value="A test letter you can delete...">
Type your name: <input type="text" name="namn" SIZE="40">
Type your Email address: <input type="text" name="email" SIZE="40">
Type your comment:
<textarea name="comment" rows="4"cols="40"></textarea>
<input type="submit" value="Send">
<input type="reset" value="Reset!">
</form>

Short explanation of the fields

There are a couple of different fields that should be explained:

1
<form method="post" action="/cgi-bin/FORMMAILNAME">

This line tells which script should receive data from the form when we press our "Send" button. Change this line according to your needs.

1
<input type="hidden" name="recipient" value="test@your.domain">

There are a number of different fields that can be filled with information, but that you might not want to be visible on screen. For this you use a "hidden" field, something that exists in the html document but will not be visible on the screen viewed with a web browser. One of these is a field called "recipient" which is used to state where the mail should be sent. In this case, test is receiving the mail. Dont forget to change this line to fit your needs.

1
<input type="hidden" name="subject" value="A test letter you can delete...">

 

If you want to, it is possible to specify the title(subject) of the mail, but this is not needed. Formmail always demands that there is a recipent of the letter specified, but the title line is not necessary.
As there are many different hidden fields that can be used, we want to refer to the documentation for formmail found here.