Open Webmail Mods
Open Webmail is a wonderful server-side mail client. At the time of this writing, the current version is 1.70.
There are a couple modifications that I made to make it more useful in an ISP environment:
1. When logging on from any given virtual host, the domain name prefix may be inserted into the person's return address. For example, if the user goes to: http://www.domain.com/cgi-bin/openwebmail/openwebmail.pl , his address upon logging in will be "user@www.domain.com". This is incorrect, as it should be "user@domain.com". Here are the diff patches to fix this behaviour:
--- openwebmail.pl.orig Wed Jul 17 01:18:25 2002 +++ openwebmail.pl Thu Jul 18 22:44:38 2002 @@ -48,7 +48,7 @@ } # validate allowed_serverdomain -my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; # remove port number +my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; $httphost=~s/[Ww][Ww][Ww]\.//; # remove port number if (! is_serverdomain_allowed($httphost) ) { print "Content-type: text/html\n\nService is not available for domain ' $httphost '"; exit 0; @@ -87,7 +87,7 @@ } $siteconf="$config{'ow_etcdir'}/sites.conf/$domain"; } else { - my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; # remove port number + my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; $httphost=~s/[Ww][Ww][Ww]\.//; # remove port number $siteconf="$config{'ow_etcdir'}/sites.conf/$httphost"; } readconf(\%config, \%config_raw, "$siteconf";) if ( -f "$siteconf"); @@ -119,7 +119,7 @@ login(); } else { # no action has been taken, display login page - my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; # remove port number + my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; $httphost=~s/[Ww][Ww][Ww]\.//; # remove port number my $siteconf="$config{'ow_etcdir'}/sites.conf/$httphost"; readconf(\%config, \%config_raw, "$siteconf";) if ( -f "$siteconf");
--- openwebmail-shared.pl.orig Fri Jul 12 01:16:31 2002 +++ openwebmail-shared.pl Thu Jul 18 22:46:23 2002 @@ -138,7 +138,7 @@ if ($loginname=~/\@(.+)$/) { $siteconf="$config{'ow_etcdir'}/sites.conf/$1"; } else { - my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; # remove port number + my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; $httphost=~s/[Ww][Ww][Ww]\.//; # remove port number $siteconf="$config{'ow_etcdir'}/sites.conf/$httphost"; } readconf(\%config, \%config_raw, "$siteconf") if ( -f "$siteconf"); @@ -297,7 +297,7 @@ # processing auto if ( ${$r_config}{'domainnames'} eq 'auto' ) { if ($ENV{'HTTP_HOST'}=~/[A-Za-z]\./) { - $value=$ENV{'HTTP_HOST'}; $value=~s/:\d+$//; # remove port number + $value=$ENV{'HTTP_HOST'}; $value=~s/:\d+$//; $value=~s/[Ww][Ww][Ww]\.//; # remove port number } else { $value=`/bin/hostname`; $value=~s/^\s+//; $value=~s/\s+$//; @@ -450,7 +450,7 @@ if ($loginname=~/^(.*)\@(.*)$/) { ($user, $domain)=($1, $2); } else { - my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; # remove port number + my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; $httphost=~s/[Ww][Ww][Ww]\.//; # remove port number ($user, $domain)=($loginname, $httphost); } my $default_realname=$user; @@ -462,7 +462,7 @@ $u=get_user_by_virtualuser($l, "$config{'ow_etcdir'}/$virtname"); if ($u eq "") { my $d=$domain; - if ($d=~s/^(mail|webmail|www|web)\.//) { + if ($d=~s/^(mail|webmail|www|WWW|web)\.//) { $l="$user\@$d"; $u=get_user_by_virtualuser($l, "$config{'ow_etcdir'}/$virtname"); } else { @@ -480,7 +480,7 @@ if ($u=~/^(.*)\@(.*)$/) { ($user, $domain)=($1, $2); } else { - my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; # remove port number + my $httphost=$ENV{'HTTP_HOST'}; $httphost=~s/:\d+$//; $httphost=~s/[Ww][Ww][Ww]\.//; # remove port number ($user, $domain)=($u, $httphost); } }
Next, when users first log in, it takes the user's name field from the unix password file, and uses that as the label name. This is not valid on my system, so the following patch removed this feature:
--- auth_unix.pl.orig Sat Jul 20 15:18:56 2002 +++ auth_unix.pl Sat Jul 20 15:22:49 2002 @@ -45,6 +45,7 @@ if ($uid) { $homedir="/export$homedir" if (-d "/export$homedir"); } + $realname = $user; # Bob mod! return($realname, $uid, $gid, $homedir); }
Finally, there wasn't an obvious way for the person to change their nickname displayed in the FROM: of the messages sent through the Open Webmail. This patch added a link in the preferences page right next to the FROM: selection:
--- openwebmail-prefs.pl.orig Mon Jul 22 00:39:30 2002 +++ openwebmail-prefs.pl Mon Jul 22 00:57:06 2002 @@ -348,6 +348,7 @@ -labels=>\%fromlabels, -default=>$prefs{'email'}, -override=>'1'); + $temphtml .= qq| <a href="$config{'ow_cgiurl'}/openwebmail-prefs.pl?action=editfroms&sessionid=$thissession&sort=$sort&folder=$escapedfolder&firstmessage=$firstmessage" title="$lang_text{'editfroms'}">Edit Name/Email address</a> |; $html =~ s/\@\@\@FROMEMAILMENU\@\@\@/$temphtml/;
Here is my default config file:
# # Open WebMail configuration file # # This file contains just the overrides from openwebmail.conf.default # please make all changes to this file. # # This file sets options for all domains and all users. # To set options on per domain basis, please put them in sites.conf/domainname # To set options on per user basis, please put them in users.conf/username # domainnames auto auth_module auth_unix.pl mailspooldir /var/spool/mail dbm_ext .db dbmopen_ext none ow_cgidir /home/httpd/cgi-bin/openwebmail ow_cgiurl /cgi-bin/openwebmail ow_htmldir /home/httpd/html/openwebmail ow_htmlurl /openwebmail logfile /var/log/openwebmail.log spellcheck /usr/bin/ispell default_language en default_headersperpage 20 default_disablejs yes default_iconset Cool3D.English default_moveoldmsgfrominbox no <default_signature> </default_signature> loginerrordelay 0 refreshinterval 5 fetchpop3interval 5 default_usesmileicon no default_confirmmsgmovecopy no