1and1 Help Centre Categories

print article

Example 2: Set the E-Mail Subject

The e-mail has the subject "WWW Form Submission" in the previous FAQ. This example extends by adding a customized e-mail subject line.

No further change to FormMail.pl is required, we just add an extra line to the HTML form. The new line is:

<input type="hidden" name="subject" value="Favorite Animal" />   
With this line added, the HTML now looks like:

 <title>What is your favorite animal?</title>
 <form method="post" action="http://yourDomain.com/FormMail.pl">
  <input type="hidden" name="subject" value="Favorite Animal" />
    <td>What is your name?</td>
    <td><input type="text" name="visitorsName" /></td>
    <td>What is your favorite animal?</td>
    <td><input type="text" name="favAnimal" /></td>
    <td colspan="2"><input type="submit" /></td>
You will need to replace the text in red above with the location of the FormMail.pl script and the desired subject.

Since the subject is set via the form page rather than in the FormMail configuration itself, you can have many different forms on your site, each using a different subject for the e-mail.