LSTOWN-L Archives

LISTSERV List Owners' Forum

LSTOWN-L

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Ben Parker <[log in to unmask]>
Fri, 16 Apr 1999 01:46:26 -0600
text/plain (261 lines)
Many customers have asked how they can setup a List Signup cgi-bin form on their
own web site so that people can simply 'click a button' to join (or leave) the
list(s) hosted on a LISTSERV 1.8d server (there or anywhere).

There are 2 basic ways to do this and an alternate discussed below.
(Note: this information is based on lists hosted on our server
'PEACH.EASE.LSOFT.COM'  If your server is different, then simply substitute your
server name wherever you see peach.ease.lsoft.com in the command strings, etc.
The working cgi demo however exists only on the PEACH server.)

1.  Write your own cgi-bin script so that it sends a regular email message to
the LISTSERV server with a properly formatted command string.  This is a
straightforward operation and relatively easy to perform.  This can work with
any version of LISTSERV.

2.  LISTSERV 1.8d runs our own cgi script which includes these capabilities. You
can simply 'call' our script with the proper parameters and the subscriber will
be able to join or leave the list(s).  This method requires the user to
'confirm' their joining the list.  Many LISTSERV admins seem to not want to
"inconvenience" the user by making them do this, however such confirmation has 3
important advantages:

  A.  It tests that the email address the user entered is valid and that it
  will reach the intended subscriber.  You would be amazed at how many
  people cannot seem to get this correct (at least 35%), either entering an
  invalid address or the address of some other person.  Some corporate email
  systems have also been configured to reject list email and this also can
  be tested this way.

  B.  It prevents malicious 3rd parties from subscribing a user to a list
  without that user's consent.

  C.  In these days of 'spam' and unwanted commercial email, confirmation by
  the user is a overt positive act that they agree to and proves they want to
  receive the emails generated by your list(s).

LISTSERV 1.8d's confirmation message can be responded to either via email by
replying to the message with the simple word 'OK' (detailed instructions are in
the message) or via a clickable URL also found in the message.  The actual
message text is partially configurable in the CONFIRM1 template of *.MAILTPL.

                         ====================

In greater detail:

Method 1.  (cgi impersonates user and sends "subscribe" command)

You can write your cgi so that the mail message is formatted as though the user
were issuing a normal SUBSCRIBE command.  This requires no special privileges or
security.  User will receive a 'welcome' or 'signoff' message as appropriate,
which you prepare in the usual manner with information about your list.  The
user may be required to 'confirm' their subscription (as explained above)
depending on certain list header settings (Subscription= Open,Confirm).
User confirmation is not needed to signoff:

  Date:  today @ now
  From:  user@address
  To:    [log in to unmask]

  SUBSCRIBE listname  Fname Lname

To leave the list the command is

  SIGNOFF listname

(no name is used for the signoff, it will produce an error if present)

the 'user@address' comes from the user's form input on the site.  The Fname &
Lname are the user's Firstname and Lastname if known.  If you don't want this,
then just substitute the 2 word phrase  'No Name'.

LISTSERV 1.8d hosted lists may also use an alternate 'single-line' address
format:

  Date:  Today @ now
  From:  Fname Lname <user@address>
  To:    [log in to unmask]

  (no message text needed)

To leave the list the special action address is

  To:    [log in to unmask]


Method 1A. (cgi is specially authorized List Owner and sends "add" command)

In this case the message comes as an ADD command from a pre-authorized 'From:'
address.  This requires use of a plain text password to verify the From:
address.  No user confirmation is possible via this method.  The user may or may
not receive a 'Welcome' or 'signoff' message depending on the command string.

To have your website script submit an ADD command for getting people to join
your list it must be able to issue a single line email command string.

  Date:    Today @ now
  From:    webserver123@hostname
  To:      [log in to unmask]

  [QUIET] ADD listname user@address Fname Lname  PW=??????

To leave the list the command string is

  [QUIET] DELETE listname user@address PW=???????


the 'user@address' comes from the user's form input on the site.  The Fname &
Lname are the user's Firstname and Lastname if known.  If you don't want this,
then just substitute the single character '*' or the phrase 'No Name'. The
PW=????? is a password assigned to the 'From:' address of the email which you
determine but will usually be something like 'webserver123@host_name' .  The
QUIET modifier is optional.  If used, you do not use the [] brackets.  QUIET
will prevent LISTSERV from sending any acknowledgement or welcome/signoff
message to the user.  Also the ADD command does not require any confirmation
from the user.

To be successful, the email From: address that will be used by the script, must
be installed as a valid but Quiet: List Owner with power to issue commands in
the List Header.  You also have to assign it a password that you choose using
the PWC command.

CAUTION:  For either method above it is advisable that you incorporate some
processing in your cgi script to validate the user's email address, at least as
syntactically valid per RFC822.  In the first case the request may simply go off
into never-never land.  But in the second case you especially must trap the '*'
char if entered as an address.  LISTSERV will recognize the '*' as a wildcard
matching any address.  Thus it is possible for a valid and authorized command to
be issued that can delete all subscribers from the list, unless you perform
validation checks on the user-submitted address before sending it to LISTSERV.

                       ======================

Method 2.  This calls an existing cgi-script on the LISTERV 1.8d host.

This is the WWW equivalent of the email 'Method 1' above.  The user will be
required to 'confirm' their subscription, and will receive the appropriate
Welcome/Signoff message.  Confirmation is not needed to signoff.

It is really very easy.  Below is the *minimum* code sequence for calling our
WA.EXE cgi-script.  You can embellish this with add-ons and collect additional
information for your own use, or add all sorts of whistles and bells that have
meaning for your site if you wish.  However, this is the minimum needed by our
cgi-script.

You can demo this minimum interface, which is intentionally made as simple and
un-fancy as possible by going to:

  http://peach.ease.lsoft.com/signupdemo.html

In order to be fully successful, you also need to make certain modifications to
the *.WWWTPL dynamic web templates so that the default site pages normally
created by LISTSERV are not accessible and instead include the necessary
references to re-direct users to your site for signup.

This is the signupdemo.html file:
======== cut here =========
<title>Join or leave the BenTest5 list</title>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#FF0000">
<center><h1>Join or leave the BenTest5 list</h1></center>
<hr>
<! Begin wa.exe calling demo>
<! Below is the code you will need to add to your site>
<form action="HTTP://PEACH.EASE.LSOFT.COM/SCRIPTS/WA.EXE">
<!Note above URL for calling cgi script needs to be customized to the host>
<input type=hidden name=SUBED2 value="BENTEST5"><!default LISTNAME to join>
<input type=hidden name="A" value=1><!required low security parameter>
<!Variables needed: (case in variable names is significant!)>
<!s= email address>
<!L= listname>
<!p= username phrase: Fname Lname>
<!t= "" empty but required>
<!q= "" empty but required>
<table>
<tr valign=top>
 <td nowrap><b>Your e-mail address:</b></td>
 <td><input name=s size=30 value=""></td>
 <input type=hidden name=t value=""></td>
<tr valign=top>
 <td><b>Your name:</b></td>
 <td><input name=p size=30 value=""></td>
 <input type=hidden name=q value=""></td>
<tr valign=top>
 <td><b>Select a list:</b></td>
 <!Note: you can insert a 'select' table here for multiple lists>
 <td><input type=hidden name=L value="BENTEST5">BenTest</td>
<tr>
 <td></td>
 <td>
<input type=submit name="b" value="Join the list">
<input type=submit name="a" value="Leave the list">
</td>
</tr>
</table>
</form>
======== cut here =========

To customize the above simple script you will have to replace instances of
BENTEST5 with your own ListName where necessary, and you should also replace
'peach.ease.lsoft.com' with your own server address.  You also have change the
SIGNUP WWW template.  See below.

All the LISTSERV related *.html pages are re-generated at least once daily from
template files.  Since they are 'dynamic' you should never make changes to the
*.html pages themselves, but only to the templates used to generate the final
html pages.  This is a complex process and you should tread carefully.  Before
modifying any templates, you should study the default.*TPL template files
(mailtpl is mostly text messages with some html, wwwtpl is all html) to be sure
you understand the existing functions before modifying them.

Below is the minimum code necessary to change the default templates on your own
LISTSERV host site to work just like the above example.  Before using this code,
you should Read Chap 9 of the Owners Manual (or the Site Mgr manual) which
discusses template files and how to GET the DEFAULT.*TPL files and modify the
desired portions.

see  http://www.lsoft.com/manuals/1.8d/owners/index.html

You can also use the LISTSERV 1.8d WWW List Management interface (if activated)
to modify these templates.

We must customize the JOIN_URL to your own site
(URL below is for the working Demo only)

Note:  The LAYOUT-data template is NOT editable via the WWW interface, but
SUBEDIT-MAIN is.

Note2: Modifying this template in this way disables the user from later
modifying their own Subscription Options (such as MAIL/NOMAIL, DIGEST/INDEX,
etc) via the WWW interface. (They can always modify them via email commands.)
Since this simplified signup procedure is normally used only for one-way lists
where all subscriber options are preset anyway and not intended to be changed
this is not a serious limitation.  The very creative programmer will figure out
how to fit it into the existing and highly complex SUBEDIT-MAIN template.

=== cut here ===
PUT BENTEST5 WWWTPL PW=?????
>>> LAYOUT-data   all layout customization variables go here
+SE JOIN_URL http://peach.ease.lsoft.com/signupdemo.html
>>> SUBEDIT-MAIN Authenticated subscribe/leave, main page
<title>Join or Leave the &+LISTNAME; list</title>
<center><h1>Join or Leave the &+LISTNAME; list</h1></center>
<p>
+BB &+MSG;
<hr><p><b>&+MSG;</b><p>
+EB
<hr>
<p>Thank you!  Your Request has been Processed.
<p>To confirm
your identity and prevent third parties from tampering with the list,
an e-mail message with a confirmation code will be sent to
the address you specified in the form. Simply wait for this message
to arrive, then follow the instructions to confirm the operation.
<hr>
=== cut here ===

Note3:  If you prefer, you can replace the above SUBEDIT-MAIN template with a
simple redirect:
 <meta http-equiv="refresh" content="0; URL=http://totally.other.page">
Obviously, this completely prevents the user from editing their subscriber
options.

ATOM RSS1 RSS2