Simple mail server with webmail

Simple mail server by using postfix MTA, dovecot IMAP + SASL and SquirrelMail webmail. This guide is for getting basic mail server working in small amount of time. You can always add more features later.

postfix MTA
Remove ssmtp. (Blocks postfix)

emerge -C ssmtp

Install postfix. Enable use flags : dovecot-sasl ipv6 pam ssl hardened?

Configure postfix :

Edit aliases. Redirect root mails, add line "root: user"

nano /etc/mail/aliases

generate aliases

newaliases

redirect root mails to user. Add line : "user@localhost"

nano /root/.forward

check for errors

postfix check

start postfix

/etc/init.d/postfix start

Check /var/log/mail.log for any errors.

cat /var/log/mail.log

dovecot IMAP, POP & SASL
install dovecot. enable use flags : bzip2 ipv6 maildir pam ssl zlib

Configure dovecot :

Start dovecot

/etc/init.d/dovecot start

SquirrelMail webmail
Change dir to webserver root

cd /var/www/htdocs

Unpack squirrelmail

tar xjf squirrelmail-webmail-1.4.22.tar.bz2

configure squirrelmail

cd squirrelmail-webmail-1.4.22/config

cp config_default.php config.php

nano config.php

edit following :

$data_dir = '/home/user/.squirrelmail/data/';

$attachment_dir = '/home/user/.squirrelmail/attach/';

$domain = 'example.com';

Create data dirs and set permissions

mkdir -p /home/user/.squirrelmail/data/

mkdir -p /home/user/.squirrelmail/attach/

chown -R user:lighttpd /home/user/.squirrelmail/

chmod -R 770 /home/user/.squirrelmail/

Test config.

Open url on web browser : http://example.com/squirrelmail-webmail-1.4.22/src/configtest.php

Everything sould be working now :)