MAILTO Example

This is a demonstration page (not in beautiful HTML) which shows how you can get information very simply if all you want is to have it mailed to you. This simply sends mail with all of the entries nicely formatted.

To use this script, create a form (you can use View Source on this document to see an example of how it might be done) which has the fields you want to have the user fill out and send on.

There are five special fields you also may want to have:

to

Actually, you have to have this field. This field is the address that the email message will be sent to. If you don't have this field, then the whole form will bomb out.

Like all the fields, you have two options on this one. First, you could make it hidden. Do this by inserting the text:

type="hidden"
in the field definition. Take a look at the source code to see what I mean.

The thing about hidden fields is that the user doesn't see them (unless he or she peeks at the form). The other option would be to make the field an actual field the user could fill out. Personally, I don't like that idea, but if you want to turn your WWW server into a way to send mail, I suppose it's a possibility.

from

Where the mail is from. Use this sparingly! The reason that this is here is to let you, the web designer, make it easier on yourself to see where things are coming from. It is not here to create a general purpose mail-forging tool. However, if you ask the user to fill in the from field with their username, you may be able to actually reply to their message. I say may, because it will only work if they typed their name in right.

subject

The subject line. Used to help you know what form this came from.

success and failure

These are COMPLETE URLs which are where the user will be "jumped" to when the mail is sent (or, in the case of the failure field, when the mail is not sent). This lets you have a nice thank you note, with buttons and all that, which the user sees when they have sent mail.

The best way to understand this form is to play with it, so this page is a good example. In this case, I have made the "from" and "subject" lines constant (e.g., hidden). However, I have made the "to" line fill-in-able; you should put your own email address in there.

When you get the message, you'll also notice some other, extra, fields at the bottom of the page. These are other miscellaneous things that HTML tells us that I thought might be useful to you. You can ignore them or use them. Remember, though, that nothing is secure and you can't trust anyone not to lie.

You can also put other things on the form as "hidden;" this might just be comments to yourself or whatever. On this form, I put a version number just to keep track of things.


Please fill in the next three fields
Where do I send mail to:
What URL do I jump to if it works:
What URL do I jump to if it does not work:

You can order flowers from us by filling out the form below.

Type in the delivery street address:

Type in the delivery phone number:

What kind of flowers would you like? Pick as many as you'd like.

  • Carnations
  • Roses
  • Dead Ones
  • How would you like to pay for this delivery?

    What do you want the card to say?

    What do you think of ordering flowers over the WWW?

    I like it!
    It's OK
    I don't like it!
    or clear the request


    jms@opus1.com/Joel Snyder/Opus One