Sending a Form Via E-mail
-
"Poor Man's CGI" - a way to collect form data via JavaScript.
-
Pretty easy, but somewhat dependent on client software.
-
Put all the info in the ACTION attribute of the form tag.
-
Informs user that form will be sent by e-mail.
<form name="entryform" action="mailto:jonesbl@one.net?subject=formdata"
enctype="text/html" onSubmit="validate()">
-
Important notes:
-
ACTION takes a URL. mailto: is a perfectly valid
URL. Just don't confuse it with http and put two slashes
after the colon-that won't work.
-
Extra credit: could you put ftp: there?
Probably, but I have never tried it, and you would need to find the parameters
for the username and password, which opens up a whole new security hole.
-
There's a little known fact here as well.
The mailto: URL type takes parameters after a question mark.
Here I used the subject keyword to specify a subject. Try it out!
-
The enctype attribute is a must. Without it, results vary.
-
Test this in many, many environments.
-
For our applications, we will be using CGI/Perl anyway.
Lab: Validating a form
Home
Internet II: Day 4