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)
root # emerge -C ssmtpInstall postfix. Enable use flags : dovecot-sasl ipv6 pam ssl
root # emerge --ask mail-mta/postfixConfigure postfix.
# basic config myhostname = example.com mydomain = example.com myorigin = example.com inet_interfaces = all mynetworks_style = host mydestination = $myhostname, localhost, $mydomain, mail.$mydomain, www.$mydomain home_mailbox = .maildir/ # sasl config smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
Edit aliases. Redirect root mails to webmaster, add line "root: webmaster"
root # nano /etc/mail/aliasesGenerate aliases database.
root # newaliasesRedirect root mails to webmaster. Add line : "webmaster@localhost"
root # nano /root/.forwardCheck for errors.
root # postfix checkStart postfix.
root # /etc/init.d/postfix startCheck /var/log/mail.log for errors.
root # cat /var/log/mail.log
dovecot IMAP, POP & SASL
Install dovecot. Enable use flags : bzip2 ipv6 maildir pam ssl zlib
root # emerge --ask net-mail/dovecotConfigure dovecot.
protocols = imap pop3
# sasl config
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0660
user = postfix
group = postfix
}
}
Start dovecot.
root # /etc/init.d/dovecot start
SquirrelMail webmail
Change dir to webserver root.
user $ cd /home/webmaster/htdocsUnpack squirrelmail.
user $ tar xjf squirrelmail-webmail-1.4.22.tar.bz2Configure squirrelmail.
user $ cd squirrelmail-webmail-1.4.22/configuser $ cp config_default.php config.phpuser $ nano config.php$data_dir = '/home/webmaster/.squirrelmail/data/';<br /> $attachment_dir = '/home/webmaster/.squirrelmail/attach/';<br /> $domain = 'example.com';<br />
Create data dirs and set permissions.
user $ mkdir -p /home/webmaster/.squirrelmail/data/user $ mkdir -p /home/webmaster/.squirrelmail/attach/root # chown -R webmaster:lighttpd /home/webmaster/.squirrelmail/user $ chmod -R 770 /home/webmaster/.squirrelmail/Debug squirrelmail by opening url : http://example.com/squirrelmail-webmail-1.4.22/src/configtest.php
You can access webmail by opening url : http://example.com/squirrelmail-webmail-1.4.22/. Everything should be working now :)