|
Webmaster Tips
Creating Sendmail Forms
If you're hosted somewhere other than the greenbuilder.com servers, there will probably be some differences in how this is accomplished. Ask your provider.
There are a number of reasons to use form mail. One obvious one is to keep your email address out of the reach of spammer's email address harvesting robots. If you put your email address on your site, rest assured that they'll find you.
Attached are four files that comprise the sendmail function - it will probably help to open them in a text editor and follow along with the explantion below. Put them in the same level on your site (I put mine in a folder called "contact"). Of course, if you put them in at the root level, you'll want to rename the index.html file to something like contact.html.
index.html contains the form they fill out. This part gives the account name, which is then appended to the "@domain.com" when the form is submitted. It's currently set to allow a choice of three addresses - me, jeanine, and ron. You'll need to change the names and values to your own, of course. It can be done as a SELECT as shown, radio buttons, or if there's only one recipient you can make it a hidden field.
When index.html gets submitted, the info is sent to a specialized file called Sendform.FDML and processed. Sendform checks to make sure that the email address has the correct format (something@somewhere.xxx), bouncing them to invalid.html if it does not. There are other tests you can include, but this is the basic one.
If it passes the email format test the data is processed by the form, sending the mail to the given address and dumping the user to Response.html. Note that you'll have to change some details in the sendmail portion:
The part enclosed by <SENDMAIL> </SENDMAIL> contains the mailserver, the TO address, the FROM name and address, and the Subject in that order. The message body is everything that follows the </SENDMAIL> tag. You *must* have a correctly formatted TO: and FROM: address, or it won't send. In this example, all the fields are populated with the values entered on the previous page, using the NetCloak <REPLACE variable> function.
You can easily customize these pages so that they look like the rest of your site. Basically, pull the stuff between the BEGIN TEXT comment and the END TEXT comment, and wrap it with your own nav/header/footer.
You can also add more fields. If you wanted to create a questionaire or survey, for instance, you can just create additional text input fields in your index.html file. Then you can use the <REPLACE> function to include the data in the message body of your Sendform.FDML file. Like this:
in index.html:
1) Why are you sending this? <INPUT type = "text" name = "question1" size = "40">
2) How did you find out about us? <INPUT type = "text" name = "question2" size = "40">
in Sendform.FDML:
(blah blah blah)
</SENDMAIL>
<REPLACE message>
<REPLACE question1>
<REPLACE question2>
Note that all variable names ("message", "question1", and "question2" in the above example) MUST begin with a letter, not a number.
The files (these should all open with Stuffit or Zip):
index.html
invalid.html
response.html
Sendform.FDML
|