MailIt! is a module on www.micro.com that allows you to quickly and easily send
email from HTML forms without a CGI script. Here's how:
- Create your "thank you" page. This is the page a visitor to your site will
see after they click the "Submit" button.
- Create your HTML form. Add as many fields as you like, but make the form's
METHOD equal to POST and make the form's ACTION
reference your "thank you" page. An example of this might be:
<FORM ACTION="thanks.html" METHOD=POST>
- Edit your "thank you" page once more. Anywhere inside the
BODY
block, you must insert a mailit block.
- The
mailit tags must surround the entire MailIt! code block.
- There must be a
mailheader tag specifying a recipient for the
email. An example of this might be <mailheader to="someone@somewhere.com">.
- There must be a
mailheader tag specifying a subject for the
email. An example of this might by <mailheader subject="Good news!">
- There must be a
mailmessage block inside the mailit
block that specifies the text of the email message.
- Lastly, information from the HTML form can be inserted using the
mfield
tag. An example of this might be <mfield name="real_name"/>
- Notice the trailing / right before the > ! This is important!
An example of an HTML form that would use MailIt! might be as follows:
<FORM ACTION="thank.you.html" METHOD=POST>
Your real name: <INPUT TYPE=TEXT name="real_name">
<BR>Product number you wish to order:
<INPUT TYPE=TEXT name="product">
<BR>Total amount: <INPUT TYPE=TEXT name="amount">
<P>
<INPUT TYPE=SUBMIT VALUE="Send this!">
</FORM>
An example of the MailIt! code from the "thank you" page might be as follows:
<mailit>
<mailheader to="joeblow@somewhere.com">
<mailheader subject="Your order, sir.">
<mailmessage>
The following order was submitted by <mfield name="real_name"/>.
The order was for: <mfield name="product"/>
The total amount is: <mfield name="amount"/>
</mailmessage>
</mailit>
Note that everything between the mailit tags is removed from the
page displayed in the visitor's browser. You can however do something like
the following to get the values from the mfield tags to display on the
"thank you" page.
Your total order was for: <mfield name="product"/>
Your total amount is: <mfield name="amount"/>
<mailit>
<mailheader to="joeblow@somewhere.com">
<mailheader subject="Your order, sir.">
<mailmessage>
The following order was submitted by <mfield name="real_name"/>.
The order was for: <mfield name="product"/>
The total amount is: <mfield name="amount"/>
</mailmessage>
</mailit>
The first two lines would be shown to the webpage user with the correct
information from the form in the place of the mfield tags that corresponded
to those 'name' fields. The rest of the message would be sent to
joeblow@somewhere.com and would not be seen by the webpage user.
|