ModernJava
http://www.modernminds.com
M odule WVPanelMail

The Mail module (WVPanelMail) allows you to add a "pop-up" window to a WildView display that provides your users with a method of sending email. The Mail module is highly configurable and supports sending email using SMTP or by interfacing with a CGI program (using either a GET or POST HTTP request).

Note that this module works in conjunction with a program that runs on the host. If you do not have access to a host that supports either SMTP or CGI programs, then you will not be able to use this module. Please see the Requirements and Use documentation below for more details.

The WVPanelMail module is always added to a WildView display by using a <PANEL> tag in a WildView layout file.

This module's documentation is divided into five sections:
M odule Attributes

Each possible attribute that can be specified for a panel tag that uses the WVPanelMail module is listed below along with a link to the attribute's description.

Be aware that attribute values are shown for illustrative purposes only: refer to each attribute's description for information regarding attribute requirements.

<PANEL
   module="WVPanelMail"
   name=WebPage
   x=10
   y=10
   w=50
   h=25
   windowW=350
   windowH=300
   title="Email to John Doe"
   buttonText="Send Mail to John"
   toName="John Doe"
   toAddr=jdoe@modernminds.com
   requireFrom=true
   subject="Mail for John Doe"
   message="Type message for John here."
   editable=true
   host=http://www.modernminds.com
   cgi="WVMail.cgi"
   usePost=true
   enable=true
>

Based on the example panel tag above, the email window that will be displayed will be similar to the illustration below (the appearance of the window will vary somewhat depending on the operating system):

EMail Window

Note that attribute names and attribute values are always converted to lowercase internally (this does not apply to the tag type name -- "PANEL" -- which must always be in uppercase characters).

If you wish to preserve the case of an attribute value (e.g., you are specifying a file name that has upper and lower case characters), then you should surround the attribute value with quotation marks. Also, if there is a space character in an attribute value, then you should use quotation marks around the entire attribute value.

A ttribute Descriptions

Each attribute of the WVPanelMail panel tag is defined below. The attribute's use is described and the valid attribute values are listed.
module

The module attribute identifies the Java component that will be associated with the panel.

In order to use the WVPanelMail module, this attribute must be set as:

module="WVPanelMail"

Note that the module name is within quotation marks in order to preserve the case of the characters.

Be sure that the spelling and the capitalization of the module name match exactly, or WildView will not be able to locate the module.
name

The name attribute allows you to assign a name to the panel.

Panel names are primarily used in conjunction with triggers in order to identify what panel a trigger is being sent to, or in some cases, what panel the trigger was received from.

Panel names are also used by WildView when logging error conditions in order to identify the panel that encountered the error.

The name attribute is optional, but if it is not specified then you will not be able to send triggers to this panel from other panels.
x

Note: The x attribute is not needed if the WVPanelMail is activated only by triggers (i.e., the panel has no "mouse click" area of its own in the WildView display).

The x attribute determines where the left edge of the panel will be located in the WildView display area.

For instance, if the WildView display area has a total width of 200, and if a value of 100 is specified for the panel's x attribute, then the panel will be located with its left edge positioned in the middle of the WildView display.

The WVPanelMail module will only respond to mouse clicks that occur within the rectangle defined by the x, y, w, and h attributes (see also the enable attribute).

Panel Area
y

Note: The y attribute is not needed if the WVPanelMail is activated only by triggers (i.e., the panel has no "mouse click" area of its own in the WildView display).

The y attribute determines where the top edge of the panel will be located in the WildView display area.

For instance, if the WildView display area has a total height of 100, and if a value of 50 is specified for the panel's y attribute, then the panel will be located with its top edge positioned in the middle of the WildView display.

The WVPanelMail module will only respond to mouse clicks that occur within the rectangle defined by the x, y, w, and h attributes (see also the enable attribute).

Panel Area
w

Note: The w attribute is not needed if the WVPanelMail is activated only by triggers (i.e., the panel has no "mouse click" area of its own in the WildView display).

The w attribute determines the width of the panel in the WildView display area.

For instance, if the WildView display area has a total width of 200, and if the panel's x attribute has a value of 20, and the panel's w attribute has a value of 160 (positioning the right edge of the panel at 20 + 160 = 180), then the panel will be centered horizontally in the WildView display (there is a margin of 20 to the left of the left panel edge and a margin of 200 - 180 = 20 to the right of the right panel edge).

The WVPanelMail module will only respond to mouse clicks that occur within the rectangle defined by the x, y, w, and h attributes (see also the enable attribute).

Panel Area
h

Note: The x attribute is not needed if the WVPanelMail is activated only by triggers (i.e., the panel has no "mouse click" area of its own in the WildView display).

The h attribute determines the height of the panel in the WildView display area.

For instance, if the WildView display area has a total height of 100, and if the panel's y attribute has a value of 10, and the panel's h attribute has a value of 80 (positioning the bottom edge of the panel at 10 + 80 = 90), then the panel will be centered vertically in the WildView display (there is a margin of 10 above the top panel edge and a margin of 100 - 90 = 10 below the bottom panel edge).

The WVPanelMail module will only respond to mouse clicks that occur within the rectangle defined by the x, y, w, and h attributes (see also the enable attribute).

Panel Area
windowW

This attribute defines the width of the email window when it is first displayed (note that the window may be manually resized after it is displayed).

An email window is displayed when the WVPanelMail panel is enabled and the mouse button is clicked in the area defined by the x, y, w, and h attributes, or if a <TRIGGER> is received with a showNow=true attribute.

If a value for this attribute is not specified, the the window will be displayed with a default width of 350 pixels.
windowH

This attribute defines the height of the email window when it is first displayed (note that the window may be manually resized after it is displayed).

An email window is displayed when the WVPanelMail panel is enabled and the mouse button is clicked in the area defined by the x, y, w, and h attributes, or if a <TRIGGER> is received with a showNow=true attribute.

If a value for this attribute is not specified, the the window will be displayed with a default height of 300 pixels.
title

This attribute defines the text displayed in the title bar of the email window.

In the example illustration of the email window shown above, the attribute:

title="Email to John Doe"

results in the text "Email to John Doe" being displayed in the window's title bar.

If a value is not specified for this attribute, then the title text will default to "Send Email".
buttonText

This attribute defines the text assigned to the "Send" button in the email window. When the "Send" button is clicked, the process of sending the email is started.

In the example illustration of the email window shown above, the attribute:

buttonText="Send Mail to John"

results in the "Send" button being labeled "Send Mail to John".

If a value is not specified for this attribute, then the title text will default to "Send Email".
toName

If a value is specified for this attribute, then the "To" text input field in the email window will be set to the text assigned to the attribute value and the field will be disabled so that the user cannot change or replace the text.

Note that if a value is specified for the toName attribute, but a value is not specified for the toAddr attribute (the email address to which the mail will be sent), then the toName attribute value will be used as the toAddr attribute value as well. This means that if a toAddr attribute is not specified, then the value specified for the toName attribute must be a valid email address.

In the example illustration of the email window shown above, the attribute:

toName="John Doe"

results in the "To" input field being set to the value "John Doe" and also disabled (the contents of the field cannot be changed by the user).

If a value is not specified for this attribute, then the "To" input field will be empty and enabled so that the user can enter a "to" name or, if the toAddr attribute is not specified, a "to" email address.
toAddr

This attribute assigns the email address to which the mail will be sent. The toAddr email address is not displayed in the email window; however, you may assign the same value to the toName attribute if you wish to have the email address displayed.

Note that when an email address is assigned using the toAddr attribute, the user cannot enter an email address. The user may however enter a name in the "To" text input field (unless the toName attribute has been assigned a value). This feature can be useful if you only have a single email address but wish to give the user the ability to identify the recipient of the email at the email address. It is also useful if you do not want the user to see the email address that the mail will be sent to.

An example of the use of this attribute is:

toAddr=info@modernminds.com

If a value is not specified for this attribute, then the value entered in the "To" input field in the email window will used as the email address.
requireFrom

The requireFrom attribute controls whether the user must enter a "from" email address before email can be sent.

If the attribute is assigned a value of true, then the user must enter a "from" email address in order to send email.

If the attribute is assigned a value of false, then the user may send email, even if a "from" email address is not entered.

If a value is not specified for this attribute, then a "from" email address must be entered in order to send email (requireFrom=true).
subject

If a value is specified for this attribute, then the "Subject" text input field in the email window will be set to the text assigned to the attribute value and the field will be disabled so that the user cannot change or replace the text.

Pre-assigning the subject text for the email is useful if you want to make it easier to identify what the email pertains to when it is received.

In the example illustration of the email window shown above, the attribute:

subject="Mail for John Doe"

results in the "Subject" input field being set to the value "Mail for John Doe" and also disabled (the contents of the field cannot be changed by the user).

If a value is not specified for this attribute, then the "Subject" input field will be empty and enabled so that the user can enter a subject for the email.
message

If a value is specified for the message attribute, then the text area located in the bottom portion of the email window where the message text is entered will be pre-set with the text assigned to the attribute value (see also the editable attribute below).

Line breaks and paragraph breaks may be embedded in the message text by using the <BR> tag for a line break and the <P> tag for a paragraph break. For instance, the attribute assignment:

message="Please enter:<P>1) Your mailing address<BR>2) Your daytime phone number"

will format the message text as:

Please enter:

1) Your mailing address
2) Your daytime phone number

Pre-setting the message text might be useful in situations where commands are being sent in the message text. For instance, a list server might require that the message body contain only the text "subscribe." In this case you could pre-assign the message text using:

message="subscribe"

and then disable the message text area using the editable attribute. Now when the email window is displayed, the user would enter their name and email address, then click the send button to subscribe to the list.

In the example illustration of the email window shown above, the attribute:

message="Type message for John here."

results in the message text area being set to "Type message for John here."

If a value is not specified for this attribute, then the message text area will be empty.
editable

The editable attribute controls whether the message text area located in the bottom portion of the email window will accept input from the user.

If the attribute is assigned a value of true, then the user may enter or change the text in the message text area. If the attribute is assigned a value of false, then the user may not enter or change the text in the message text area.

This attribute is primarily intended for use in conjunction with the message attribute.

If a value is not specified for this attribute, then the attribute value will default to true (the text in the message text area is editable).
host

The host attribute allows you to assign the URL of the host system that the WVPanelMail module will contact when it is sending email.

Normally, you should not specify a URL for this attribute. If a URL is not specified, then the host from which the Java classes were loaded will be contacted when mail is being sent.

In some situations, you may be able specify a host (see the Requirements and Use section below for more details). In most situations, a security exception will be generated if the URL specified for the host attribute does not match the URL of the host from which the applet was loaded.

An example of using the host attribute to specify a host to contact is:

host=http://www.modernminds.com
cgi

The WVPanelMail module can send email either by using the SMTP protocol, or by forwarding the mail data to a CGI program which is responsible for sending the email (see the Requirements and Use section below for more details).

The cgi attribute is used to specify the path and the file name of the CGI program on the host to which the applet will forward the email data. If a value for the cgi attribute is not specified, then the SMTP protocol will be used to send email.

For instance, suppose that the applet resides on a server whose URL is "http://www.modernminds.com" and that the cgi attribute is set as follows:

cgi="cgi-bin/Mail.cgi"

In this case, the WVPanelMail panel would send the CGI data to the program:

http://www.modernminds.com/cgi-bin/Mail.cgi

The data fields sent to the CGI program are:

fromaddr=<the value displayed in the "Your Email Addr" field, or the value displayed in the "Your Name" field if the "Your Email Addr" field is blank.>

fromname=<the value displayed in the "Your Name" field>

toaddr=<the value of the toAddr attribute, or the value displayed in the To field if toAddr is not specified>

toname=<the value displayed in the To field>

subject=<the value displayed in the Subject field>

message=<the text displayed in the message area>
usePost

If a CGI program is specified for the cgi attribute, then the usePost attribute determines what HTTP request type is used to send the mail data to the CGI program.

If the usePost attribute is set to true, then the HTTP POST request type will be used to send the data. If the usePost attribute is set to false, then the HTTP GET request type will be used to send the data.

Which HTTP request type should be used depends upon the requirements of the CGI program. For instance, if the CGI program is expecting to receive data using GET and the usePost attribute is set to true, then the CGI program will not be able to read the mail data or send the email.

The primary difference between GET and POST is that the HTTP GET request type will append the email data to the URL as an argument string whereas the HTTP POST request type will send the email data as a separate data stream. If the email message is very long and the HTTP GET request type is used, then the URL can become quite large and could possibly be truncated if the CGI program is a 16-bit program. Also, some web servers and CGI programs handle the HTTP POST request type more efficiently than the HTTP GET request type.

If a value is not specified for this attribute, then the usePost attribute will default to true (data will be sent to the CGI program using the HTTP POST request type).
enable

Note: The enable attribute is not needed if the WVPanelMail is activated only by triggers (i.e., the panel has no "mouse click" area defined by the x, y, w, and h attributes).

The enable attribute determines if the WVPanelMail panel will display the email window when the mouse button is clicked within the area defined by the x, y, w, and h attributes.

The following two values are valid for this attribute:
  • true - the email window will be displayed when the mouse is clicked in the panel area.

  • false - the email window will not be displayed when the mouse is clicked in the panel area.
Note that if the WVPanelMail panel is not enabled, the email window may still be displayed by sending a trigger to the panel (see the showNow attribute).

If a value for the enable attribute is not specified, then the value will default to "true".
R eceiving Triggers

With the exception of the window size and the email communications settings, The WVPanelMail panel can be completely controlled by sending a <TRIGGER> to a WVPanelMail panel from another panel.

This means that you can cause the email window to be displayed by using a <TRIGGER>, or you change most of the email window text fields at any time by sending a <TRIGGER> to a WVPanelMail panel.

The following are standard attributes for a WVPanelMail panel that can be specified in a <TRIGGER> that is sent to a WVPanelMail panel:
  • title - change the title bar text for the email window.

  • buttonText - change the text of the "Send" button.

  • toName - change the text that appears in the "To" field.

  • toAddr - change the "to" email address.

  • requireFrom - require a "from" email address.

  • subject - change the text in the message subject field.

  • message - change the text in the message text area.

  • editable - enable or disable user editing of message text.

  • enable - enable or disable mouse clicks in panel area.

The following are special attributes that can be specified in a <TRIGGER> only (i.e., they cannot be specified as attributes for the WVPanelMail panel tag):
updateNow

When a trigger is sent to a WVPanelMail panel, the changes specified by the trigger attributes normally do not take affect until the next time that the mail window is displayed. This means that if the email window is displayed when a trigger is received by the window's WVPanelMail panel, the email window will not be updated until the next time that it is opened.

Typically, this default behavior is what you will want, as changing text or the way the email window looks while it is open can be confusing for the user. However, there might be situations where you do want to update the window while it is displayed, therefore the updateNow attribute has been provided to allow you to do this.

If the email window should be updated regardless of whether it is currently displayed or not, then set the updateNow attribute to true.

If the updateNow attribute is not specified, or if a value of false is assigned to the attribute, then changes specified by the trigger will not take effect until the next time that the window is displayed.
showNow

The showNow attribute can be used to display the email window using a trigger.

If the showNow attribute is set to true, then the email window will be displayed if it is not currently open, or else if the email window is open, then the window will be made the top-most window.

If the showNow attribute is not specified, or if the attribute's value is set to false, then the visible state of the email window will remain unchanged.
R equirements and Use

The WVPanelMail module is unlike other WildView modules in that it requires the use of a program that resides on the host in order to function. Because of this requirement, it is possible that you might not be able to use the WVPanelMail module. The following documentation discusses how to tell if your host can support the WVPanelMail module, and how to use the module to communicate with the host program to send email.

The WVPanelMail module supports two methods of sending email: one method is to connect to a SMTP (Simple Mail Transport Protocol) server, and the other method is to call a CGI program that can send email.

If your host has a SMTP server to which the WVPanelMail module can connect, it is the easier of the two methods to use as it normally requires no additional work on your part in order to use the module. Many Internet Service Providers, however, either do not have a SMTP server running on the same machine as their web server, or else they have configured the SMTP server so that "relaying" email is not allowed. Either of these two conditions will make it impossible for the WVPanelMail module to send email using SMTP.

If it is not possible to use SMTP, then it may be possible to use a CGI program to send email. A CGI program is a program that resides on a web host that can be run using the HTTP POST or GET request type. CGI programs are typically used to support forms embedded in web pages and are often written using the Perl programming language.

Be aware that due to the potential security risks of running CGI programs on the host, many Internet Service Providers do not allow users to place CGI programs on the web server.

Instructions for using the SMTP and CGI methods of sending email are described in separate sections below. If your host is unable to support either the SMTP or CGI methods of sending mail, but you have access to another host that will support one of these methods, then you may be able to use that host for sending mail. See the section Using an Alternate Host below for further information.

SMTP Method

This section answers some common questions regarding using the WVPanelMail module to send email via SMTP.

Q   How can I tell if I can use SMTP?
A   A quick way to check to see if there is a SMTP server running on the same machine as the WWW server is to use a Telnet program and attempt to telnet to the server on port 25.

If you are using Windows95, you can do this by opening a DOS prompt and typing "telnet <your www url> 25". For instance, if your home page was on the Modern Minds WWW site, you would type:

telnet www.modernminds.com 25

If there is a SMTP server running, then you should see a response message from the server indicating that you are connected (there could be a delay before you see the message depending upon how busy the server is). If there is no SMTP server running, then you should receive an error message such as "Connect Failed!"

If you did get a connection on port 25, then you've got a fairly good chance of being able to use the WVPanelMail module's SMTP method of sending email. There's still a chance that the SMTP server might be configured to prevent "relaying" email, so you'll need to actually test the module in a panel set that has been uploaded to your web server to make sure it works.

Q   How do I test my SMTP connection?
A   Even if you are able to connect to a SMTP server, there might be a problem sending email through the server. This is because some system administrators configure the SMTP server to prevent "relaying" email that does not originate on the host system. Since most of the people who access your site do not have accounts on the host system that serves your web pages, it is possible that the SMTP server could refuse to send their email.

In order to verify that the SMTP server will deliver email sent from the WildView applet, you should upload a panel set that includes a WVPanelMail panel to your WWW server, then test sending email.

Here is a very simple applet tag and panel set that you can copy for testing purposes (this example assumes that the HTML file, the panel set file, and the Java class files are all in the same directory):

The HTML file "TestMail.html" is defined as follows:

<HTML><HEAD>
<TITLE>SMTP Mail Test</TITLE>
</HEAD><BODY>

<APPLET WIDTH="100" HEIGHT="100"
  CODE="WildViewApplet.class">
<PARAM NAME="color"
  VALUE="ff0000">
<PARAM NAME="panelSet1"
  VALUE="TestMail.TXT">
</APPLET>

</BODY><HTML>

The panel set "TestMail.TXT" is defined as follows:

<PANEL name="SMTP Mail Test"
  module="WVPanelMail"
  w=100 h=100 title="SMTP Email Test"
  subject="SMTP Email Test"
  message="Type your test message here.">

After you have uploaded the files to your WWW server (note that because of security restrictions, this test must be run from a web server), load the TestMail.html page in your browser, and click anywhere in the applet area (which is colored red).

When you click in the applet area, the email window will be displayed. Make sure that you enter a "To" address (and optionally a "From" address as well), then click the "Send Email" button.

Once the "Send Email" button has been clicked, the applet will begin sending the email using SMTP. Keep your eye on the status line located below the email text input area. The status line will display the applet's progress as the email is sent.

If the email is sent successfully, then the email window will disappear. If any error is encountered during the send, then an error message will be displayed on the status line (you can resize the window to make it larger if you cannot see the entire error message, or you can check the Java console or Java log).

If the send was successful, then check your email periodically to make sure that the message is delivered. Once you have verified that SMTP will work from your Internet account, try sending email from another account (or ask a friend to try sending email using the applet from a different account).

If you are able to send email from at least two different accounts, then congratulations, you are now ready to begin using the WVPanelMail in your own panel sets!

If you received an error while sending email using SMTP, then chances are that your Internet Service Provider has configured the system in such a manner that it is not possible to send email from the applet using SMTP. Don't worry yet though, there's another method that might work for you. See the documentation for using the CGI Method below.

Q   Can I use a SMTP server on another host?
A   Due to Java security restrictions, in most situations an applet cannot connect to a host other than the host from which it was loaded. If you are an experienced Java user, you might be able to "sign" the applet (using, for instance, Microsoft's CAB technology), thus allowing connections to any host. In this case, you can use the host attribute to specify a URL for a host that has a SMTP server.
CGI Method

In contrast to the SMTP method of sending email, the CGI method does not require that the applet be able to open a connection to a mail server on the host. Instead, the WVPanelMail module will call a CGI program on the host and pass it the email information. It then becomes the CGI program's responsibility to send the email.

This section answers some common questions regarding using the WVPanelMail module to send email via the CGI method.

Q   What are the host requirements?
A   In order to be able to send email using the CGI method, you must have the ability to run a CGI program on your WWW host, and you must have a CGI program on the host that can send email.

If you do not know if your Internet Service Provider allows CGI programs, please contact your ISP's Customer Service department.

Q   Where can I get a CGI program that will send email?
A   If your host will run CGI programs that are written in Perl, then you might be able to use the example Perl program (WVMail.cgi) that is included in the WildView package (found in the Examples/Perl directory).

To use the program, first check to make sure that the path and name of the mail program is correct for your host. The program line in WVMail.cgi that specifies the host's mail program is:

$mailprog = '/usr/lib/sendmail';

Change this line if necessary so that the Perl program will be able to locate the host's mail program.

Next you will need to upload the WVMail.cgi program along with the support library cgi-lib.pl to the appropriate directory on your web server. If you use an FTP program to upload the files, then make certain that you upload the files as ASCII files and not as binary files.

Once the files have been uploaded, you may need to assign the proper file permissions so that the Perl programs can be run. For instance, on a Unix host you would use the chmod command to assign the proper permissions (e.g. "chmod 750 WVMail.cgi"). Note that Perl libraries (which is what the cgi-lib.pl file is) might need permissions that are different than Perl programs (e.g. "chmod 640 cgi-lib.pl").

If you are not sure what the name or location of your host's mail program is, or if you are unsure of the proper directory for CGI programs, or if you do not know what the correct permission settings are for CGI programs, then please contact your Internet Service Provider.

Now it's time to check to see if the Perl programs have been installed correctly. Open a web browser and enter the following URL (replace the text in blue with values appropriate for your site and do not place any space characters in the following URL ):

http://www.yoursite.com/cgi-bin/
   WVMail.cgi?subject=Test+Message&
   toaddr=you@yoursite.com&
   toname=anybody@yoursite.com&
   fromname=someone@yoursite.com&
   fromaddr=you@yoursite.com&
   message=This+is+a+test

If all goes well, after you send the request you should see a page that looks similar to the following:

Email Browser Test Result

If you receive a message that says something like "Document contains no data," then there is probably a problem either with the permission settings for the either the CGI program (WVMail.cgi) or the Perl library (cgi-lib.pl) that you uploaded, or you may have entered the name or path of the mail program incorrectly in the WVMail.cgi CGI program. In any event, you'll need to carefully go back over the material discussed above to find out where the problem lies.

The final (and most important) validation that everything is working is to actually receive the email that should have been sent when the CGI program processed the URL. If you don't receive the email in a reasonable period of time, then check to make sure that you specified your host's mail program correctly in the WVMail.cgi CGI program.

! Note that the example Perl program is provided as a courtesy only. Modern Minds specializes in Java programming, and cannot provide support for Perl programs or provide assistance with Perl related questions. Also, the included cgi-lib.pl support program is by Steven E. Brenner (who holds the copyright for the program). For the latest version of cgi-lib.pl or more information about the program, please visit the web site http://www.bio.cam.ac.uk/cgi-lib/.

Q   Does the WVMail.cgi program expect data from a GET or a POST HTTP request?
A   The example CGI program included with WildView will accept data sent to it using either GET or POST.

You can use the usePost attribute to set the HTTP request type that the WVPanelMail module uses to send data to a CGI program.

Q   Can I place the CGI program on another host?
A   Due to Java security restrictions, in most situations an applet cannot connect to a host other than the host from which it was loaded. If you are an experienced Java user, you might be able to "sign" the applet (using, for instance, Microsoft's CAB technology), thus allowing connections to any host. In this case, you can use the host attribute to specify a URL for a host that has a SMTP server.

Q   I'd like to write my own CGI program. What data is sent from the applet to the CGI program?
A   The data sent from the applet to the CGI program is described in the documentation for the cgi attribute.
Using an Alternate Host

If your Internet Service Provider does not provide support for sending email using the SMTP or CGI methods as implemented by the WVPanelMail module, you may still be able to use WildView to send email if you have access to another host that does support SMTP or CGI. For instance, suppose that you have a friend who has an account with an Internet Service Provider that allows CGI programs to be run, and suppose that your friend (very kindly) has given you permission to upload the WildView class files to his account. All that you need to do is change the applet tag in your HTML so that the CODEBASE attribute is assigned a URL that points to the Java class files that you uploaded to your friend's site.

Here's an example. Let's imagine that your web site has a URL of http://www.yoursite.com and that your index.html file has the following applet tag:

<APPLET CODEBASE="Java"
  WIDTH="110" HEIGHT="30"
  CODE="WildViewApplet.class">
<PARAM NAME="panelSet1"
  VALUE="SendMail.TXT">
<PARAM NAME="color"
  VALUE="000000">
</APPLET>

The SendMail.TXT file is a panel set that uses the WVPanelMail module to send email. After testing on your site, you find (to your great disappointment) that your Internet Service Provider does not support sending mail from the applet.

Now let's imagine that a friend hears of your problem and offers to let you use his account since he is able to run Perl CGI programs and he knows that a Perl CGI program is able to send email on his host. You accept his offer, and he creates a directory called "JavaMail" for you to use on his site (which has a URL of http://www.hostsite.com).

What you would now need to do is to upload the WildView Java class files, the SendMail.TXT panel set file, and any graphics files that your panel set uses to directory referenced by the URL http://www.hostsite.com/JavaMail, and then change the applet tag in your index.html file to:

<APPLET CODEBASE="http://www.hostsite.com/JavaMail"
  WIDTH="110" HEIGHT="30"
  CODE="WildViewApplet.class">
<PARAM NAME="panelSet1"
  VALUE="SendMail.TXT">
<PARAM NAME="color"
  VALUE="000000">
</APPLET>

You of course would also need to upload the CGI program to the appropriate directory on the site http://www.hostsite.com and set any necessary permissions required to run the CGI program. Note that you might need to update the WVPanelMail panel's cgi attribute in your SendMail.TXT panel set as well.

Now when the web page http://www.yoursite.com/index.html is loaded in a browser, the browser will load the applet from http://www.hostsite.com/JavaMail and will send email by contacting http://www.hostsite.com rather than contacting http://www.yoursite.com.

This technique of changing the CODEBASE applet attribute so that it points to Java class files located on another server will also work if you are able to use the SMTP method of sending email on the alternate host site.
E xample

A simple example of how the WVPanelMail module can be used in a panel set is available on an example page.
Copyright © 1997 by Modern Minds, Inc.