A sample page that sends email

This page has a sample form for sending email. Below the form is the HTML source for the form and sample email message sent by the form. (This page doesn't actually send mail to anyone; it just illustrates how to make a form to do that.)

Forms consist of items that have names. To our email processing program, four names are special: recipient must be the name of an item specifying who is to receive the email. This item is required. Only addresses listed in a special configuration file can receive mail from forms. You must have us list your address if your want your form to send you email.

Three other special names are optional. An item called name can let users specify their real name. An item named email will let the user say where he or she wants email replies sent, and one named subject can specify the subject of the email.

All other items names must begin with the string "content". They will appear in the body of the email with the item named used to label the value of the item.

Your Real Name

Your Email Address


Please type a message:

Please type another (brief) message:

Click to submit your message. Click to clear your message and start over.

The HTML that generated the above form and an example mail message sent with it:

<!-- Declare the program that sends the mail (required) --> <form method="POST" action="/cgi-bin/email"> <!-- A "recipient" must be specified, and the recipient must be listed in our email config file. Please use lowercase when specifying the recipient's email address, and let us know who you are emailing to so we can put you on the access list. Generally we will only let your form send mail to yourself. --> <input name="recipient" value="user@NetHeaven.com" type="hidden"> <!-- If "name" is provided, it will be used for a 'From:' header --> <input name="name" value="John Doe">Your Real Name<p> <!-- If "email" is provided, it will be used for a 'Reply-To:' header --> <input name="email" value="jdoe@someplace.edu">Your Email Address<p> <!-- If "subject" is provided, it will be used for a 'Subject:' header --> <input name="subject" value="Example email form">Subject<p> <!-- Anything with a name that begins with "content" will become part of the message body, labelled with its name. As examples we use "content6" and "content-brief", but you can use any name beginning with the string "content". IF THE NAME OF YOUR TEXTAREA DOES NOT BEGIN WITH THE STRING "content" IT WILL BE IGNORED! --> <p>Please type a message:<p> <textarea name="content_message" rows=5 cols=60 value="Here's some text."></textarea> <p> <p>Please type another (brief) message:<p> <textarea name="content-brief" rows=1 cols=12></textarea> <p> <!-- Give the user a "submit" button --> Click <input type="submit" value="submit"> to submit your message. <!-- Give the user a panic button --> Click <input type="reset" value="reset"> to clear your message and start over. </form> ---End of the HTML that generated the form-- A sample mail message sent with the form. ______________________________________________________________________ From: jdoe@someplace.edu To: user@NetHeaven.com Subject: Example email form Reply-To: jdoe@someplace.edu Supposedly-From: John Doe Status: R This message was sent through the www-email gateway, and the sender cannot be authenticated. Unauthenticated sender is jdoe@someplace.edu content_message: This is a message that I typed into the message box to show what the message will be like when the email recipient gets it. content-brief: Another brief message --