Mon, February 19, 2018 ยท 1 min read

Setting up simple mail server with sendmail + dovecot + squirrelmail on fedora 26

Setting up simple mail server with sendmail + dovecot + squirrelmail on fedora 26

Sendmail is a MTA (Mail Transfer Agent) in Linux used to send emails. Dovecot is a mail authentication software. Squirrelmail is a mail user agent similar to an email client.

  1. Install the packages:
dnf install sendmail sendmail-cf sendmail-doc cyrus-sasl-{lib,plain} dovecot squirrelmail
  1. Configure sendmail:

Edit /etc/mail/sendmail.mc:

  • Line 122: set DAEMON_OPTIONS('Port=smtp,Name=MTA')dnl
  • Line 161: set LOCAL_DOMAIN('server.sand.box')dnl

Build the configuration file:

cd /etc/mail
make all

Restart sendmail:

systemctl restart sendmail
  1. Configure Squirrelmail:
cd /usr/share/squirrelmail/config/
./config.pl

Set organization preferences and server settings as needed.

  1. Configure Dovecot:

Edit configuration files in /etc/dovecot/:

  • 10-mail.conf: set mail_location = maildir:~/Maildir
  • 10-ssl.conf: set ssl = yes
  • 10-auth.conf: set disable_plaintext_auth = no and auth_mechanisms = plain login
  • dovecot.conf: set protocols = imap pop3 lmtp and listen = *

Restart services:

systemctl restart dovecot; systemctl restart sendmail; systemctl restart httpd

Now you can access Squirrelmail from https://localhost/webmail.

To forward root emails to another user:

formail -s /usr/sbin/sendmail -oi -t < /var/mail/root