WebSTAR 4 Manual & Technical Reference

Manual Contents | Chapter Contents | Previous Page | Next Page

WebSTAR Form Mail

You can have web pages on your server send HTML form data by email, using the WebSTAR Form Mail Plug-In. This works on the server itself, and does not require the user's browser to be set up to use the " mailto: " tag. For example, you may want to have visitors send a message to the webmaster, ask a sales question or contact someone in your company. Be sure to configure your Form Mail Plug-In, especially the SMTP Host, according to the instructions WebSTAR Form Mail Administration .

This Plug-In was previously called WebSTAR QuickSend and used the form action " .quicksend ".

WebSTAR Form Mail is a very simple forms mailer, and can only have one recipient. For more complex form mail tools, see the lists of third-party extensions to WebSTAR at:

http://www.starnine.com/extendingwebstar.html

Using WebSTAR Form Mail

WebSTAR Form Mail works with an HTML form to send the entered text via email. Make the FORM ACTION x.formmail and the METHOD post . Then add form fields with specific names for the message information, and let the sender fill in the data (or you can pre-enter it and hide the elements). When the visitor clicks the "Submit" button in their browser, the server will call the WebSTAR Form Mail Plug-In to transfer the message. To see how this works, see WebSTAR Form Mail Examples .

WebSTAR does not install the WebSTAR Form Mail Plug-In by default. Use the WebSTAR Server Suite Installer to install it. It does not require any additional RAM.
The Form Mail Plug-In is always enabled. It will only run if a form contains the Action x.formmail .

Form Fields

You must use these exact words as your form field tags to work with WebSTAR Form Mail:

The " To " and " From " fields must be filled in: if they are not, WebSTAR Form Mail will display an error page requiring the person to enter them. You can enter the associated data beforehand, in visible or hidden fields, or have the person enter the data in their browser.

For additional fields, see Additional Form Mail Options .

Sender Identification

For security and accountability, WebSTAR Form Mail includes the IP address of the browser machine. This address is recorded in an "X-Comment" field in the message header:

 

X-Comment: (via WebSTAR) originating sender 198.211.93.29

Including this line prevents the WebSTAR Form Mail Plug-In from being used as an anonymous remailer: the originator is always identified.

WebSTAR Form Mail Examples

In this example, the form is set up to send a message to the webmaster. Therefore, the email, subject and message fields are visible, but the "To" field is hidden.

To improve the layout of forms, use tables, as in the formmail.html example.
 
 

<FORM ACTION="x.formmail" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">
 
	<P>Subject: <INPUT TYPE="TEXT" NAME="Subject" SIZE="25"> 	From: <INPUT TYPE="TEXT"NAME="From" SIZE="25"></P>
 
	<P>Message: <TEXTAREA NAME="Body" ROWS="7" COLS="35">		</TEXTAREA></P>
 
	<P><INPUT TYPE="HIDDEN" NAME="To" SIZE="-1" 			
 
		VALUE="webform@domain.com"> 	<INPUT TYPE="RESET" NAME="Reset" VALUE="Reset"> 	<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Send"> </P>
 
</FORM>

When the sender fills in the information in the browser and clicks the Send button, the WebSTAR Form Mail Plug-In will be called. It will format the message, call the SMTP host, and send the message. If you look in your log, you'll see the x.formmail URL.

Table Form Example

The file named formmail.html in the Form Mail folder in the Tools & Examples folder displays a more elegant layout for the form, using table cells to line up the fields. It's a very good example to customize to your own needs.

WebSTAR Form Mail Administration

To change settings on the WebSTAR Form Mail Plug-In, use your browser to open the administration page, and choose the WebSTAR Form Mail Plug-In at the URL like this:

 
http://www.domain.com/pi_admin.formmail

(replacing the name www.domain.com with your host name).

Mail Host

Enter the default mail (SMTP) host for WebSTAR Form Mail to use when sending mail. SMTP hosts take care of sending mail for POP/SMTP email programs, such as browser mail modules and client programs.

If you are using WebSTAR Mail, you can put your server name in this field. If you are using a different mail server, check with your mail administrator to be sure that this host will accept mail from your WebSTAR server: some hosts are restricted to certain accounts.

You can also override the default mail host in your web page forms: see Mail Host for details.

Timeout in Seconds

The timeout value specifies the amount of time to wait for any response from the mail host. If WebSTAR Form Mail can't get a response in this time, it will fail to send the message, and will display this error in the browser (if you use "mail. domain.com " as your default host):

 
Host mail.domain.com did not respond to a connection request.
Be sure to save your changes--it's very easy to forget. If you are getting unexpected results, check your settings again.

If you have a slow mail server, you should increase the timeout value. The timeout range is 30 seconds (the default) to 3 minutes, configurable in 30 second increments.

Additional Form Mail Options

Mail Host

WebSTAR Form Mail must have an SMTP host to send the mail. You usually set this in the Admin page as described in WebSTAR Form Mail Administration .

To override the default SMTP host, put a hidden form field with a name of "Host" and a value filled in with a host name in the form block, as in:

 

<INPUT TYPE="HIDDEN" NAME="Host" VALUE="domain.com"> 
 

 

Specifying the mail host in the form will override the admin setting.

In general, it's better to use one standard mail host than to use the host in the "To" field. You should configure the overall mail host information using WebSTAR Form Mail's Administration options.

If no host has been configured and the HTML does not contain a form "Host" element, then WebSTAR Form Mail uses the host information from the " To: " field, and attempts to connect to that system.

Custom Return and Error Pages

You can have the Form Mail Plug-In return special pages based on the success or failure of a message.

The fields "Return-HTML" and "Error-HTML" must match exactly for this to work. In addition, the VALUE part of the field should contain a path to custom files, relative to the WebSTAR root folder. In these examples, the WebSTAR root folder contains a folder named mailfiles .

Custom Return File

If you want to display a special page when the mail is sent, add a hidden field to the form block in a WebSTAR Form Mail HTML form like this:

 

<INPUT TYPE=HIDDEN NAME="Return-HTML"
 
VALUE=":mailfiles:return.txt">

This file is displayed in the browser when the Form Mail Plug-In sends the message successfully.

Custom Error File

If you want to display a custom Error HTML file to the sender, add a hidden input type to the form block in a WebSTAR Form Mail form page:

 

<INPUT TYPE=HIDDEN NAME="Error-HTML"
 
VALUE=":mailfiles:qserror.txt">

This file is displayed in the browser when the email has an error and can't be sent. If the " To: " or " From: " field is missing, a standard WebSTAR Form Mail error page is displayed.


Manual Contents | Chapter Contents | Previous Page | Next Page