#!/usr/bin/perl
# The above line may need to be changed to reflect the location of
# the perl interpreter on your system. Use "which perl" on a Unix system
# to make a noble attempt to locate your perl interpreter. If you are
# installing this on an NT server then you probably do not need to modify
# this line because it will most likely be ignored.
############################################################################
# MailMan, Standard Edition, version 3.0.2
#
# Copyright (c) 1996, 1997, 1998, Endymion Corporation. All rights reserved.
# Endymion Corporation: http://www.endymion.com/
# Originally by Ryan Alyn Porter, rap@endymion.com
#
# This product is not free and is not in the public domain.
# For detailed information on the licensing structure of MailMan, see
# http://www.endymion.com/products/mailman/
#
# Initiated: 4/24/1998 Version 2.0 beta
# Released: 7/20/1998 Version 2.0
# Last Modified: 12/17/1998 Version 3.0.2
############################################################################
#use strict;
# Version information that might find its way into output.
$strMailManVersion = 'v3.0.2';
$strMailManEdition = 'Standard Edition';
# If you are having problems with MailMan not working at all, please
# take a look at the MailMan FAQ, stored online at
# http://www.endymion.com. A version of the FAQ should also have been
# in the distribution that contained this file.
############################################################################
# This section contains a few variables that you might need to set in order
# to get MailMan functioning properly. If your installation is working,
# then you don't need to worry about any of these.
############################################################################
# Outgoing Banner Text
# This is the banner that is appended to the end of any message that
# this MailMan installation sends. One reason why this is one of the
# first configuration options is because we want to make it very
# obvious that you can remove or modify this banner. Endymion places
# no restrictions at all on this banner, so don't worry about leaving
# credit to us in here or anything like that. Please feel free to
# change this to whatever you like, or completely remove it. If this
# value is not defined then it will simply append no banner.
$strOutgoingBannerText =
"\n" .
"---------------------------------------------\n" .
"This message was sent using Endymion MailMan.\n" .
"http://www.endymion.com/products/mailman/\n";
# Incoming Mail Server:
# The way that we originally intended to allow people to 'rig' the server
# names for an installation was through simple template modifications, as
# mentioned in the FAQ. A lot of people have asked about ways to rig the
# server names in the script itself though, so we added this. We aim to
# please... If you want to rig your incoming server name so that it makes
# no difference at all what an incoming form specifies, just un-comment
# this line and specify it.
#$strIncomingServer = 'mail.endymion.com';
# Outgoing Mail Server:
# Same deal, different server.
#$strOutgoingServer = 'mail.endymion.com';
# From Domain Name:
# Set this variable to override the domain name that is assumed when a
# user logs in. For instance, when the user "rap" logs into the POP3
# server "mail5.it.endymion.com", MailMan will assume that his address
# is "rap@mail5.it.endymion.com". If you set this variable to
# "endymion.com", then it will assume that his address is
# "rap@endymion.com" instead. If the mapping between POP3 user names
# and email addresses is more complicated then you will need to actually
# build your own routines to do the mapping. For instance, if the user
# "endy-rap" at the POP3 server "shell1.ba.best.com" actually receives
# mail at the address "rap@endymion.com", then you will need to do make
# your own custom mapping routine to deal with this.
#$strFromDomainName = "endymion.com";
# Outgoing Domain Name:
# When a user specifies a recipient name without full domain qualification
# ("rap" instead of "rap@endymion.com", for example) then the SMTP server
# should provide configuration rules for determining how to deal with this
# mail. It should not be the responsibility of the mail client to fill in
# a complete address. We have had many requests for a feature to allow
# an administrator to specify a default domain name, however, and we aim
# to please. This configuration variable is the result. If you want
# MailMan to assume a default domain name when it is given an incomplete
# address, uncomment this line and set it to your domain name. We strongly
# recommend against this, however, you should be looking into your SMTP
# server's configuration options and not using this feature.
#$strOutgoingDomainName = 'endymion.com';
# Messages Per Page:
# This value controls the number of messages returned per page in a
# message list. Adjust it if you like.
$iMessagesPerPage = 10;
# Local Template Location:
# If you have a web server that sets the current directory to something
# strange, you can set this to an absolute path to make it easier to
# allow MailMan to find the templates. Just set this variable to an
# absolute path like "C\:\\inetpub\\wwwroot\\mailman\\templates\\"
# or '/usr/home/rap/mailman/' or whatever. Note the final slash, that's
# important. If you leave it out then things won't work. If you need
# to set this value, then un-comment the following line:
#$strLocalTemplateLocation = "D:/inetpub/wwwroot/Endymion2/products/mailman/demo/";
# Local Script Location:
# If your server is one of the ones that causes problems that require the
# above value to be set, then you might also need to set this value. In
# most cases your script location and your template location will be
# identical, but if you move your templates to a different directory than
# your script for whatever reason, then you will need to set this. If you
# have no idea what I'm talking about, you should probably just leave this.
$strLocalScriptLocation = $strLocalTemplateLocation;
# URL Image Location:
# Use this to rig the URLs that will be used to access the images that
# the templates point to. This value will be prepended to any value in
# the templates of the form ""i_*.gif"" (including the inner quotes).
# If you have customized your templates and your own custom images are
# not showing up in MailMan's output, it is probably because the custom
# images that you are using are not named "i_*.gif".
# To use this variable, set it to the exact value that you want prepended
# to image names in order to make them into URLs that will point to your
# image directory. For instance, if you bury your images in an "images"
# directory under the directory where MailMan is installed, set this to
# 'images/' (with the slash). If you put your images in a completely
# different directory, something that is rooted, like '/mailman/images/'
# might be what you are looking for. In the most extreme cases you can
# do away with relative URLs entirely and provide a complete absolute URL
# like the one below
#$strURLImageLocation = 'http://www.endymion.com/images/';
# Use Perl 'alarm()' function:
# Set this to TRUE if your Perl interpreter supports "alarm". As of this
# Writing, NT Perl does not. If this is not set, MailMan will not be able
# to timeout when a server hangs. The OSSettings() routine will attempt
# to set this variable, but you can override it here if you want.
# The point of the "alarm" feature as used in MailMan is to allow MailMan
# to detect when a mail server has not responded within a reasonable
# amount of time. If your server's Perl interpreter does not support
# "alarm", then MailMan will still work, but if a mail server ever does
# not respond then the user will get no feedback to that effect.
#$bUseAlarm = TRUE;
# Timeout Duration:
# The aforementioned timeout delay. Set this to something else to modify
# how long MailMan will sit around waiting for a mail server to respond.
# Only works if $bUseAlarm is set to TRUE.
$iTimeoutDurationInSeconds = 180;
# Use Perl 'crypt()' function:
# Some Perl impelentations apparently do not support the crypt() function.
# We have never seen one, and there are plenty of implementations out there
# that you should be able to find a good one, but we try to accomodate
# anyway. Comment out this line if your Perl implementation is breaking
# on the crypt() function. Be warned that if you do this your users'
# usernames and passwords will be less obfuscated than they were before,
# which admittedly wasn't much. This is a good place to repeat the
# suggestion that MailMan is an excellent candidate for SSL and other
# fancy HTTP security mechanisms.
#$bUseCrypt = TRUE;
# Use Hijack Test:
# MailMan performs a test to determine if the current session has been
# hijacked by a different user from a different address. On a few
# systems this will not work because of the configuration. If your
# MailMan installation sits behind a cluster of caching proxy servers
# for load balancing, for instance. If you want to disable the hijack
# checking functionality, just comment out this line.
#$bUseHijackTest = TRUE;
# Kiosk Mode:
# If you are using MailMan in a kiosk environment, it will generally
# be possible for a user to use a combination of "BACK" and "RELOAD" in
# the kiosk web browser to intrude backwards into the mail sessions of
# previous users. If you set this value then MailMan will operate in
# kiosk mode, which means that when a user logs in, MailMan will create
# a new browser window with that user's session. If the user logs out
# then that window will close, and the user's history information will
# go with the window so that intrusions with "BACK" and "RELOAD" aren't
# possible. We recommend against using this feature for installations
# that are not kiosk-based because it relies on Javascript and cookies,
# which does not leave users with older browsers with a way in. If you
# are in a kiosk environment then you have control over the browser an
# that's not a problem. We strongly recommend against using the
# Microsoft Internet Explorer for kiosk environments because it does not
# properly respect the "Expires:" and "Cache-control:" HTTP headers, so
# IE will cache user mail to the hard drive whether you want it to or
# not. Microsoft appears to have no interest in fixing this problem.
# IE 4 SP1 pretty consistently crashed during our tests of the
# full-screen popup window kiosk mode, too, which is likely not exactly
# the behavior that you are looking for in your kiosk browser.
# The kiosk mode feature primarily activates and deactivates sections
# of outbound templates, so if you have customized your templates before
# you decided to use kiosk mode then it is entirely possible that you
# broke this mode by removing vital Javascript. Consult the
# out-of-the-box template set for examples of the Javascript snippets
# necessary for this mode.
#$bKioskMode = TRUE;
############################################################################
# You should not have to configure any values after this line.
############################################################################
use Socket; require $strLocalScriptLocation . 'mmcgilib.pl'; local(%mma, %mmb,
%mmc, %mmd); ReadParse(\%mma,\%mmb,\%mmc,\%mmd); foreach $mme (keys %mma) {
if($mme =~ /^(.+)\.[xy]$/) { if($mme =~ /^([^\#]+)\#(.*)\.[xy]$/) {
$mma{$1} = mmie($2); } else { $mma{$1} = 'MAILMANSPECIALTRUE'; }
delete($mma{$mme}); } } if($mma{'INTERFACE'}) { @mmf = split(/\&/,$mma{'INTERFACE'});
foreach $mmg (@mmf) { if($mmg =~ /^([^\=]+)\=(.*)$/) {
$mma{$1} = mmie($2); } }
unless($mma{'INTERFACE'} =~ /ALTERNATE_TEMPLATES/) {
$mma{'ALTERNATE_TEMPLATES'} = ''; } } @mmh = split(/\;/,$ENV{'HTTP_COOKIE'});
foreach $mmi (@mmh) { $mmj = TRUE; if($mmi =~ /MailManAuth\=(\S+)/) {
@mmk = split(/\&/,$1); foreach $mml (@mmk) { $mml =~ /^(.+)\#(.+)$/;
unless($mma{$1}){ $mma{$1} = $2; } } } } $mmm = mmii($mma{'USERNAME'});
$mmn = mmih($mmm); $mmo = mmii($mma{'PASSWORD'});
$mmp = mmih($mmo); unless($strIncomingServer){ $strIncomingServer =
mmii($mma{'SERVER'}); } $mmq = mmih($strIncomingServer);
unless($strOutgoingServer){ $strOutgoingServer = $mma{'OUTGOING'}; } $mmr = '';
$mms = mmic($ENV{SERVER_NAME},42);
$mms .= mmic($ENV{REMOTE_HOST} . $ENV{REMOTE_ADDR},69);
$mmt = mmih($mms); mmib(); $mmu = $ENV{SCRIPT_NAME};
unless($mmu =~ /^\//){ $mmu = "/$mmu"; } $mmv = $mmu;
$mmv =~ s/^(.*[\\\/])[^\\\/]+$/$1/; if($mmv eq '/') { $mmw = ''; } else {
$mmw = "path=$mmv; "; } sub mmgs { if($mma{'NOFRAMES'}) { $mmx = TRUE; }
if($mma{'NOCACHE'}) { $mmy = TRUE; } if(defined($mma{'ALTERNATE_TEMPLATES'})) {
$mmz = $mma{'ALTERNATE_TEMPLATES'}; } } sub mmgt { my($mmaa) = @_;
foreach $mme (keys %mma) { if($mme =~ /^$mmaa\:(.*)$/) { $mmab = $1; return $mmab; } }
return; } mmgs(); mmgu();
@mmh = split(/\;/,$ENV{'HTTP_COOKIE'}); foreach $mmi (@mmh) {
if($mmi =~ /MailManCmds\=(\S+)/) { @mmac = split(/\&/,$1); foreach $mmad (@mmac) {
$mmad =~ /^(.+)\#(.+)$/; unless($mma{$1}){ $mma{$1} = $2; } } } } mmgs();
mmgu(); mmgw(); sub mmgu {
if($mma{'BLANK'}) { mmia('t_blank.htm'); } if($mma{'MENU'}) {
mmia('t_f_menu.htm'); } if($mma{'LOGOUT'}) { if($bKioskMode) {
mmia('t_closewindow.htm'); } else { mmgw(); } } if($mma{'START'}) {
mmgw(); } if($mma{'LOGIN'}) { if($mmae = mmgy()) {
if(defined($mmaf)) { $mmaf =~ s/^\-ERR(.*)$/$1/; } $bKioskMode = 0;
$mmag{'GREETING'} = "
The output template "$mmfr" exists and was found by the MailMan\n| .
qq|script, but the script does not have permission to read it.
\n| .
qq|
On most Unix systems, you can go to the directory where MailMan is\n| .
qq|installed and type "chmod 644 $mmfr" to solve this problem. If\n| .
qq|your HTTP server is running in a different operating in a different\n| .
qq|operating system, consult your HTTP server and operating system \n| .
qq|documentation for more information.
The output template "$mmfr" could not be found by the MailMan \n| .
qq|script.
Make sure that this template is located where MailMan can \n| .
qq|find it (in the same directory as the script itself on most web servers,\n| .
qq|but not necessarily) and make sure that the web server process has\n| .
qq|permission to read the file. Consult your HTTP server and operating\n| .
qq|system documentation for more information.