[imp] Fwd: ISP based IMP and IMAP config (single server) and etc.

Chuck Hagenbuch chuck at horde.org
Mon Sep 1 16:45:02 PDT 2003



----- Forwarded message from  -----
    Date: Mon,  1 Sep 2003 17:07:00 -0500
 Subject: ISP based IMP and IMAP config (single server) and etc.
      To: chuck at horde.org, jon at horde.org

Chuck and Jon,

I scoured the postings on using multiple domain names, but I didn't see anyone
who had done exactly as I had done, so I came up with the following set up stuff
for using a single server that combines IMP and IMAP and multiple domains.

FYI: I had to modify login.php to get a more friendly username response after
logging in (since the actual usernames on the linux box are of the form
"user_domain_toplevel").  I didn't see any simple way to get the user's full
name that you apparently get somehow via IMAP, so I settled on the account name
used in the "from:" identity.  I have included the login.php mods in hopes that
you would put in the changes (or something similar) in future releases.

Feel free to post this on whatever media that you like.  Please do not use my
e-mail address in the posting as I am trying to avoid e-mail harvesting spyders.
 I prefer not to post on most media locations since they still require a public
display of an e-mail address. (I'll post to public forums if they use a private
e-mail mechanism.)  If you post to a public forum, you may list my contact
information as the administrator on the home page of www.seeclouds.com.  The
mechanism is an online form that uses no e-mail addresses in the form.

FYI:  You guys have done a great job on this software.  Keep it up!

login.php changes:

    $fullname = ucfirst(Auth::getAuth());
// jmj - 8/30/2003 - clean up virtual hosts...
// jmj - 8/30/2003 - hooks fullname is apparently not yet set - hard coded
//    if (!empty($conf['hooks']['fullname']) && function_exists($conf['hooks']['
fullname'])) {
#       $fullname = call_user_func($conf['hooks']['fullname'],  Auth::getAuth())
;
//    } else {
//       $fullname = ucfirst(Auth::getAuth());
//    }
  $fullname = preg_replace("/_.*/", "", $imp['user']);

    $template = 'user.inc';

servers.php:

// jmj - 8/2/2002 - set up mail server
// jmj - 8/31/2003 - no realm (realm blank) - sendmail translating usernames

$servers['imap'] = array(
    'name' => 'IMAP Server',
    'server' => 'localhost',
    'protocol' => 'imap/notls',
    'port' => 143,
    'folders' => 'mail/',
    'namespace' => '',
    'maildomain' => strtolower(preg_replace('|^mail\.|i', '',
                    $_SERVER['HTTP_HOST'])),
    'smtphost' => 'seeclouds.com',
    'realm' => '',
    'preferred' => ''
);

// note IMAP server is localhost to prevent any hacking problems

apache.conf: (apache)

#
# main web server
#
<VirtualHost *>
#    ServerAdmin webmaster at dummy-host.example.com
    DocumentRoot /var/www/seeclouds.com
    ServerName seeclouds.com
    ServerAlias www.seeclouds.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
#
# jmj - 8/29/2003 - set up virtual e-mail
# all imp access for any server is set up via "mail.domain"
# note Alias for /horde/ - need this if you use it for a top level domain
#                          i.e. documentroot
#
<VirtualHost *>
#    ServerAdmin webmaster at dummy-host.example.com
    Alias /horde/ /var/horde/
    DocumentRoot /var/horde
    ServerName mail.seeclouds.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
#

virtusertable: (sendmail)

# virtusertable
#
# set up virtual users, i.e. user at domain translate to user_domain "users" here
#
# don't forget to do the following when you modify this file:
#
#makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable
#
@seeclouds.com %1_seeclouds_com
#

conf.php:

//$conf['hooks']['from'] = '';
$conf['hooks']['from'] = 'imp_set_username';
//
// jmj - 8/30/2003 - set up return e-mail address for virtual hosting
//

if (!function_exists('imp_set_username')) {
  function imp_set_username ($imp) {
    return preg_replace("/_.*/", "", $imp['user']);
    }
  }

more conf.php:

//$conf['hooks']['vinfo'] = '';
// jmj - 8/28/2003 - set up virtual accounts
$conf['hooks']['vinfo'] = 'imp_get_vinfo';

/* Here is an example imp_get_vinfo function. If $type == 'vdomain',
 * this function returns the HTTP_HOST variable after removing the
 * 'mail.' subdomain.
 *
 * If $type == 'username', this function returns a unique username
 * composed of $imp['user'] + vdomain.
 *
 * ex. $HTTP_HOST = 'mail.mydomain.com', $imp['user'] = 'myname'
 *   $vdomain  = 'mydomain.com'
 *   $username = 'myname_mydomain_com'
 */
 if (!function_exists('imp_get_vinfo')) {
     function imp_get_vinfo ($type = 'username') {
         global $conf, $imp;

         $vdomain = getenv('HTTP_HOST');
         $vdomain = preg_replace('|^mail\.|i', '', $vdomain);
         $vdomain = strtolower($vdomain);
         if ($type == 'username') {
             return preg_replace('|\.|', '_', $imp['user'] . '_' . $vdomain);
         } elseif ($type == "vdomain") {
             return $vdomain;
         } else {
             return new PEAR_Error('invalid type: ' . $type);
         }
     }
 }

registry.php:

// jmj - 9/1/2003 - set up generic host name

$this->applications['horde'] = array(
    'fileroot' => dirname(__FILE__) . '/..',
    'webroot' => '/horde',
    'initial_page' => 'login.php',
    'icon' => '/horde/graphics/home.gif',
    'name' => $_SERVER['HTTP_HOST'],
    'allow_guests' => true,
    'show' => true,
    'templates' => dirname(__FILE__) . '/../templates',
    'cookie_domain' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'],
    'cookie_path' => '/horde',
    'server_name' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'],
    'server_port' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_PORT']
);

php.ini: (not directly related, but broken spot in php install current release)

# jmj - 8/25/2003 - trying to get pear working...
#include_path = ".:/php/includes:/usr/share/php"
include_path = ".:/php/includes:/usr/share/php:/usr/share/pear"




----- End forwarded message -----


-chuck

--
Charles Hagenbuch, <chuck at horde.org>
They're just looking at a wall of meat.


More information about the imp mailing list