Home    Cart    Free Download    Manual

Installation:
  Free Downloads
  The H2O Family
  Install Notes

Programming:
  Prerequisites
  H2O Whitepaper
  Online Manual
  Code Examples
  H2O Free Support


What's H2O?
H2O is programming made for the web.

What's it like?
H2O is English-like. If you know some Perl, VB, ASP, or PhP you'll be immediately productive in H2O. It runs on Linux, Mac, Unix, and Windows.

How do I try it?
Download H2O for free. Get it from hosting providers. Or buy on-line.

Where does H2O come from?
The language was invented by Aestiva. H2O stands for:
   HTML with
   HTML/OS
   Overlays.


Form with Template Email

The code below can be used to send HTML emails using information posted on an HTML form. The code is template-driven, meaning, the format of the email is stored in a seperate file (as a two-coumn CSV file containing both the subject line and the body text) so changes to the email can be made without changing code.

The H2O Code Explained
When the HTML form is submitted, the overlay processform is run. The top of the overlay loads the 2-column template, putting the first cell in the variable mytext and the second into mysubject. Then search and replace's are done on the text in the template using the variables submited in the HTML form.

Then the function NETMAILSEND is used to send the email composed and the user is directed to a thank-you web page.

email.html



<html>
<title>Form with Template Email</title>
<form method=post action=processform>
First Name: <input type=text name=firstname size=15><br>

Last Name: <input type=text name=lastname size=20><br>
Street Address: <input type=text name=streetaddress size=40><br>
City: <input type=text name=city size=20><br>
State, Zip: <input type=text name=state size=2 maxsize=2><br>
<input type=text name=zipcode size=10><br>

Email: <input type=text name=email size=40><br>
Phone: <input type=text name=phone size=40><br>
Comments:<br>
<textarea name=comments rows=5 cols=40>
</textarea><br>
<input type=submit value="Send">

</form>
</html>

<<OVERLAY processform
email_templatename="template.txt"
COPY FILE=email_templatename TS="," TO void /COPY
mytext=void[1]
mysubject=void[2]
# perform search and replace on text /#
mytext=REPLACEALL(mytext,"[FirstName]",firstname)
mytext=REPLACEALL(mytext,"[LastName]",lastname)
mytext=REPLACEALL(mytext,"[Street]",streetaddres)
mytext=REPLACEALL(mytext,"[City]",city)
mytext=REPLACEALL(mytext,"[State]",state)
mytext=REPLACEALL(mytext,"[Zip]",zip)
mytext=REPLACEALL(mytext,"[email]",email)
mytext=REPLACEALL(mytext,"[phone]",phone)
mytext=REPLACEALL(mytext,"[comments]",comments)
# perform search and replace on subject /#
mysubject=REPLACEALL(mysubject,"[FirstName]",firstname)
mysubject=REPLACEALL(mysubject,"[LastName]",lastname)

NETMAILSEND("","yourname@yourserver.com",mysubject,mytext,
"40","","text/html","")
GOTO "thank_you.html"
>>



NOTE: This code assumes you are sending HTML email. If not, replace the line:
NETMAILSEND("","yourname@yourserver.com",mysubject,mytext,"40","","text/html","")
with:
MAIL mytext TO Address="yourname@yourserver.com" SUBJECT=mysubject /MAIL

Home | Cart | Free Download | Online Manual
COPYRIGHT © 2005 Aestiva, LLC. ALL RIGHTS RESERVED.