Subject: Re: Web Based mail Package
To: Frank DeChellis <frankd@iaw.on.ca>
From: Ben Collver <collver@softhome.net>
List: netbsd-help
Date: 11/29/2000 06:39:12
> What are some of the Web Based mail packages used by some of you NetBSD
> admins?

Hello,

I saw that people recommended IMP and NeoMail to you.  After trying
NeoMail, I decided it looked too unpolished, and it had troubles locking
the mail spool files on my system for some reason.

IMP looks much nicer, although there are some hoops to jump through when
setting it up.  I chose to install IMP 2.2.  Here are some notes to
supplement the IMP installation instructions.

1) apache
2) postgresql
3) php4
4) horde
5) wv
6) ispell
7) imp

1) apache
   This was straightforward except when it came to setting up the SSL support.
I want to use IMP within SSL to increase security over the Internet.  NetBSD's
apache package installs with some scripts to manipulate SSL certificates if
OpenSSL is already configured.  What helped when configuring OpenSSL was:
   http://www.pseudonym.org/ssl/wwj-index.html

2) postgresql
   After installing postgresql, I needed to edit /usr/pkg/pgsql/.profile and
add the line ". /usr/pkg/pgsql/.profile.pgsql" to it.  I also needed to edit
/usr/pkg/etc/rc.d/pgsql and change
                        -p /usr/pkg/bin/postmaster -o "-S -o -F" start \
to
                        -p /usr/pkg/bin/postmaster -o "-i -S -o -F" start \

3) php4
a) added patches/patch-aa
--- ext/imap/config.m4.orig     Sun Nov 26 19:27:22 2000
+++ ext/imap/config.m4  Sun Nov 26 19:27:36 2000
@@ -39,7 +39,7 @@
       ln -s "$IMAP_DIR/lib/c-client.a" "$IMAP_DIR/lib/libc-client.a" >/dev/null 2>&1
     fi

-    for lib in imap c-client4 c-client; do
+    for lib in imapuw imap c-client4 c-client; do
       IMAP_LIB=$lib
       IMAP_LIB_CHK(lib)
       IMAP_LIB_CHK(c-client)
b) type "make mps"
c) modify Makefile
CONFIGURE_ARGS+=--with-system-regex --without-gd \
	--with-gdbm=${PREFIX} \
	--with-yp --with-zlib --with-dbase --with-filepro \
	--with-config-file-path=${PREFIX}/etc \
	--with-exec-dir=${PREFIX}/libexec/php4 \
	--enable-track-vars --enable-force-cgi-redirect \
	--enable-discard-path --enable-memory-limit \
	--enable-sysvsem --enable-sysvshm \
	--enable-wddx --without-mysql \
-	--with-apxs=${LOCALBASE}/sbin/apxs
+	--with-apxs=${LOCALBASE}/sbin/apxs \
+	--with-pgsql=${LOCALBASE} \
+	--with-ldap=${LOCALBASE} \
+	--with-imap=${LOCALBASE}
+
+pre-configure:
+	(cd ${WRKSRC}; autoconf)

4) horde
imp needs horde, horde needs phplib, phplib needs part of imp, ha!
phplib has some incorrect instructions for modifying /usr/pkg/etc/php.ini
incorrect:
	include_path '/home/www/phplib:.'
	auto_prepend_file /home/www/phplib/prepend.php3
	track_vars on
	magic_quotes_gpc off
correct:
	include_path = '/home/www/phplib:.'
	auto_prepend_file = /home/www/phplib/prepend.php3
	track_vars = on
	magic_quotes_gpc = off

5) wv
depends on X libraries, unpack xcomp.tgz first

6) ispell
no problems

7) imp
a) imp/compose.php3
-    return (empty($tmp) ? '/tmp' : $tmp);
+    return (empty($tmp) ? '/var/tmp' : $tmp);

-                       $envelope['User-Agent'] = 'IMP/PHP IMAP webmail program ' . IMP_VERSION;
+//no need to reveal this info -Ben
+//                     $envelope['User-Agent'] = 'IMP/PHP IMAP webmail program ' . IMP_VERSION;

b) imp/lib/db.pgsql
-   
-   if (!($db = imp_open_pg_db())) { return false; }
-   if (!($result = pg_Exec($db, "select address, nickname, fullname from $default->db_address_table where username='$user@$server' order by nickname"))) { return false; }
-   if (($rowcount = pg_NumRows($result))==0) { return false; }
+
+   // put all users in /etc/passwd into the contact list -Ben
+   // I'll eventually replace this with an LDAP query
+   $fh = fopen("/etc/passwd", "r");
+   $j = 0; 
+   $buffer[$j] = fgets($fh, 1024);
+   while (!feof($fh)) {
+      $j++;
+      $buffer[$j] = fgets($fh, 1024);
+   }
+   fclose($fh);
+
+   sort($buffer);
+   $j = 0;
+   for ($i = 0; $i < count($buffer); $i++) {
+      $pw_buf = $buffer[$i];
+      $pw_pos = strpos($pw_buf, ':');
+      $pw_user = substr($pw_buf, 0, $pw_pos);
+      $pw_temp = strstr($pw_buf, ':'); $pw_temp[0] = ' ';
+      $pw_temp = strstr($pw_temp, ':'); $pw_temp[0] = ' ';
+      $pw_temp = strstr($pw_temp, ':'); $pw_temp[0] = ' ';
+      $pw_temp = strstr($pw_temp, ':'); $pw_temp[0] = ' ';
+      $pw_pos = strpos($pw_temp, ':');
+      $pw_name = substr($pw_temp, 1, $pw_pos - 1);
+      if (strlen($pw_name) > 0 && strlen($pw_user) > 0) {
+              $pw_user .= '@somecompany.com';
+             $return[$j]=array(0=>$pw_user,1=>$pw_name,2=>$pw_name);
+             $j++;
+      }
+   }
+   // end of Ben's stuff
+
+   if (!($db = imp_open_pg_db())) { return($return); }
+   if (!($result = pg_Exec($db, "select address, nickname, fullname from $default->db_address_table where username='$user@$server' order by nickname"))) { return($return); }
+   if (($rowcount = pg_NumRows($result))==0) { return($return); }

-      $return[$i]=array(0=>pg_Result($result,$i,"address"),1=>pg_Result($result,$i,"nickname"),2=>pg_Result($result,$i,"fullname"));
+      $return[$i + $j]=array(0=>pg_Result($result,$i,"address"),1=>pg_Result($result,$i,"nickname"),2=>pg_Result($result,$i,"fullname"));

c) imp/lib/mimetypes.lib
-    $pipe = popen("$default->path_to_mswordview $word_name 2>&1","r");
+    $pipe = popen("$default->path_to_mswordview $word_name $word_name.$$.html 2>&1;cat $word_name.$$.html;rm $word_name.$$.html","r");

-- 
Quidquid latine dictum sit, altum viditur.