o^3 Cubic Circle

Using /cgi-bin/mailto

This tool allows you to receive feedback from your webpages via your existing E-mail reader.

First, you need to know two things:
  1. Which E-mail address is the response going to?
  2. What is the URL of the page that is to be displayed after the user has pressed the submit button?

A most-straightforward example

This should make it clear how both fields can be defined.
<form method="post" action="http://www.cuci.nl/cgi-bin/mailto">
<input type=hidden name="sendmail_test" value="yes">

E-mail address of your favourite pizza-joint: <input name="sendmail_to">
<br>
Now enter the URL of your favourite WWW-page: <input name="next_url"   >
<br>
What flavour pizza would you like:
<select name=pizza_flavour>
 <option> Funghi
 <option> Sole
 <option> Quatre stagione
 <option> Quatre fromaggio
</select>

<input type="submit" value="Send E-mail and jump to URL"><br>
</form>

Results in this form:


E-mail address of your favourite pizza-joint:
Now enter the URL of your favourite WWW-page:
What flavour pizza would you like:

Hide them from sight

However, in most cases, you do not want the user to fill out both addresses. Most likely, you want to set them to some predefined values, like this:
<form method="post" action="http://www.cuci.nl/cgi-bin/mailto">
<input type=hidden name="sendmail_test" value="yes">

<input type=hidden name="sendmail_to" value="pizza@foo.bar"                >

<input type=hidden name="next_url"    value="your_order_was_accepted.html" >

What flavour pizza would you like:
<select name=pizza_flavour>
 <option> Funghi
 <option> Sole
 <option> Quatre stagione
 <option> Quatre fromaggio
</select>

<input type="submit" value="Order pizza"><br>
</form>

Results in this form:


What flavour pizza would you like:

Define your own Subject

The mails that you are getting, have a standard Subject: field tacked onto them. You can control what it says by modifying your form as such:
<form method="post" action="http://www.cuci.nl/cgi-bin/mailto">
<input type=hidden name="sendmail_test" value="yes">

<input type=hidden name="sendmail_to" value="pizza@foo.bar"                >

<input type=hidden name="sendmail_subject" value="Someone ordered pizza!"  >

<input type=hidden name="next_url"    value="your_order_was_accepted.html" >

What flavour pizza would you like:
<select name=pizza_flavour>
 <option> Funghi
 <option> Sole
 <option> Quatre stagione
 <option> Quatre fromaggio
</select>

Extra
<input type=radio name=extra value=cheese> Cheese
<input type=radio name=extra value=champignons> Champignons <br />

<input type="submit" value="Order pizza"><br>
</form>

Results in this form:


What flavour pizza would you like: Extra Cheese Champignons


Define your own body

So far, the body of the mail always consisted of a listing of variable name assignments. If you like, you can control the content of the body of the mail as well. Note that the value of fields can be substituted in both subject and body by simply prepending the name of the field by a dollar sign.
<form method="post" action="http://www.cuci.nl/cgi-bin/mailto">
<input type=hidden name="sendmail_test" value="yes">

<input type=hidden name="sendmail_to" value="pizza@foo.bar"                >

<input type=hidden name="sendmail_subject"
                  value="Someone ordered a pizza ${pizza_flavour}!"        >

<input type=hidden name="next_url"    value="your_order_was_accepted.html" >

What flavour pizza would you like:
<select name=pizza_flavour>
 <option> Funghi
 <option> Sole
 <option> Quatre stagione
 <option> Quatre fromaggio
</select>

<br>
How many?
<select name=nr_pizzas>
 <option> 1
 <option> 2
 <option> 4
 <option> 8
</select>

<input type=hidden name="sendmail_body"
 value="Hello!,

There seems to be a customer that would like to
order $nr_pizzas pizza ${pizza_flavour}.  Do you think
you can manage that?" >

<input type="submit" value="Order pizza"><br>
</form>

Results in this form:


What flavour pizza would you like:
How many?

Turning off testmode

As you have undoubtedly noticed, all examples didn't actually send any mail, they just display the mail that was going to be sent, along with the location of the page that was going to be called up next. This was done by inserting:
<input type=hidden name="sendmail_test" value="yes">
into the form. By simply omitting this line, the form is activated and will start sending real mail.