How can I email a form from a web page running under GMS?

  1. Home
  2. Knowledge Base
  3. GMS
  4. How can I email a form from a web page running under GMS?

Question

How can I email the contents of a form from an HTML page on a web site using the GMS server as the web server.

Answer

This is easily achieved using the Mail Meta Language (MML), a scripting language developed by Gordano. It is specifically designed to be most useful in a messaging environment.

The first step is to develop your form using standard HTML commands. As is normal each item in your form should be given a unique name. When the form is completed it should be posted to another page which contains MML code that will process the items within the form, build them into a single email message and send that message onto a given address.

The opening line of your form definition should look something like this:

<FORM ACTION="/Thanks.htm" METHOD="post" name="myForm">

The page Thanks.htm would thank the person for submitting the form and would assemble and deliver the message. In the example above it is located in the root directory of your web site, but you could change the ACTION to point to any other location on the site. The page Thanks.htm would look something like

<html>
<body>
<#
x = MsgCreate(Email, "Sales@gordano.com", Subject);
if (x) {
MsgAddBody(x, ("Message from website:"));
MsgAddBody(x, (""));
MsgAddBody(x, ("Name:      " & Name));
MsgAddBody(x, ("Email:     " & EMail));
MsgAddBody(x, ("Telephone: " & Telephone));
MsgAddBody(x, (""));
MsgAddBody(x, ("Subject:   " & Subject));
MsgAddBody(x, (Comment));
MsgAddBody(x, (""));
MsgClose(x, MSG_SEND);
}
#>
Many thanks for your email message to Sales.
</body>
</html>

Name, EMail, Telephone, Subject and Comments are, in this example, the names of the various fields on the form submitted. If you want to use different fields in your form you will need to change the above to match them. If your form has more fields than above then you should add a similar line in for each field on yoru form, changing the name appropriately.

Further information on the MML scripting language can be found inthe MML Programmers Guide which can be downloaded from here

For information on creating Forms in HTML then please consult an appropriate HTML Guide.

Keywords:mailto email form web server html

Was this article helpful?

Related Articles