User Tools

Site Tools


notes:mailboxesetc

This is an old revision of the document!


Adding MailBoxes, WebMail, AntiSpam etc

Configure mailserver as described in Mail server (for aliases only)

Add Dovecot Mailbox support (''Maildir'' format)

Install missing packages

apt-get install dovecot-pop3d dovecot-imapd php5-imap php5-mcrypt

Create file /etc/dovecot/dovecot-mysql.conf.ext:

driver = mysql
connect = host=127.0.0.1 dbname=postfix user=postfix password=<dbpassword2>
default_pass_scheme = MD5-CRYPT
user_query = SELECT '/var/vmail/%d/%n' as home, 3000 AS uid, 3000 AS gid FROM mailbox WHERE username = '%u'
password_query = SELECT password FROM mailbox WHERE username = '%u'

Edit /etc/dovecot/conf.d/10-auth.conf

disable_plaintext_auth = no
auth_mechanisms = plain login
#!include auth-system.conf.ext
!include auth-sql.conf.ext

Edit /etc/dovecot/conf.d/10-mail.conf

mail_location = maildir:/var/vmail/%d/%n:INDEX=/var/vmail/%d/%n/indexes

Edit /etc/dovecot/conf.d/10-ssl.conf

ssl = yes

Edit /etc/dovecot/conf.d/20-imap.conf

mail_max_userip_connections = 10

Edit /etc/dovecot/conf.d/auth-sql.conf.ext

passdb {
 driver = sql
 # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext
 # args = /etc/dovecot/dovecot-sql.conf.ext
 args = /etc/dovecot/dovecot-mysql.conf.ext
}
userdb {
 driver = sql
 # args = /etc/dovecot/dovecot-sql.conf.ext   
 args = /etc/dovecot/dovecot-mysql.conf.ext
}

Restart services:

service dovecot restart
service postfix restart

You can now test your e-mail server. Any errors are found as always in logfiles:

/var/log/auth.log
/var/log/mail.log
/var/log/syslog

Install RoundCube

cd /var/www/XYZ/www
wget http://sourceforge.net/projects/roundcubemail/files/roundcubemail/1.0.1/roundcubemail-1.0.1.tar.gz\?use_mirror=garr -O rcb.tar.gz
tar -zxvf rcb.tar.gz
mv roundcubemail-1.0.1/ rcb/
chown -R www-data:www-data rcb
cd rcb

Log in mysql

mysql -u root -p

Create roundcube mysql user

CREATE DATABASE roundcube;
GRANT ALL PRIVILEGES ON roundcube.* TO roundcube@localhost IDENTIFIED BY '<rcpassword>';
FLUSH PRIVILEGES;

Add initial tables and data:

mysql -u roundcube -p roundcube < SQL/mysql.initial.sql

Add timezone info to php ini file /etc/php5/fpm/php.ini:

date.timezone = America/New_York 

Go to http://XYZ/rcb/installer/. See that your environment is ok and click Next. On the ‘Create config’ page, you may want to change the following values:

product_name: <yourproductname>
support_url: <yoururl>
database name: roundcube
database password: <rcpassword>
default_host: localhost
smtp_server: localhost
language: en_US

Click Continue. Remove installer folder:

mv installer ../../

Configure one Roundcube installation to serve multiple domains

In case you have one installation of Roundcube to serve multiple domains hosted on one server you can create host-specific config files. These files have to be named like <hostname>.inc.php and are saved in Roundcube's config directory [1].

Roundcube does not read them by default so you need to set the 'include_host_config' option to true in the main config file.

If enabled, Roundcube will additionally load the file that matches the host name used to access Roundcube and merged the options configured there over the main config file. This means that they only need to contain the parameters that differ from the main configuration. Most common configurations on host-specific files are these:

<?php
$rcmail_config['default_host'] = '<imap-host-for-this-domain>';
$rcmail_config['username_domain'] = '<the-domain-name>';

Setting 'username_domain' will make Roundcube append the correct domain part if a user only logs in with its user name (e.g. 'user' instead of ​user@domain1.com).

Instead of setting 'include_host_config' simply to true, you can specify a hash array assigning host names (key) to config file names (values) like the following example

$rcmail_config['include_host_config'] = array(
  'mail.roundcube.net' => 'net_config.inc.php',
  'mail.roundcube.com' => 'com_config.inc.php'
);

Finally open RoundCube at http://XYZ/rcb/


[1] http://trac.roundcube.net/wiki/Howto_Config/Multidomains

[2] http://www.xenlens.com/debian-wheezy-mail-server-postfix-dovecot-sasl-mysql-postfixadmin-roundcube-spamassassin-clamav-greylist-nginx-php5/

notes/mailboxesetc.1409216337.txt.gz · Last modified: 2014/08/28 08:58 by admin