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 email client.

lets install the packages

$dnf install  sendmail sendmail-cf sendmail-doc cyrus-sasl-{lib,plain} dovecot squirrelmail

2.configure sendmail

$vi /etc/mail/sendmail.mc
line 122 set as  DAEMON_OPTIONS(`Port=smtp,Name=MTA')dnl
line 161 set as  LOCAL_DOMAIN(`server.sand.box')dnl
build the configuration file with make.
cd /etc/mail
make all
restart the sendmail service
#systemctl restrat sendmail

3.Configure  squirrelmail

$cd /usr/share/squirrelmail/config/
#./config.pl

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >> 1
#set organization preferences to below.

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1. Organization Name : server.sand.box
2. Organization Logo : ../images/sm_logo.png
3. Org. Logo Width/Height : (308/111)
4. Organization Title : SquirrelMail $version
5. Signout Page :
6. Top Frame : _top
7. Provider link : https://squirrelmail.org/
8. Provider name : SquirrelMail

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >> 2
#server settings set this to.

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1. Domain : localhost
2. Invert Time : false
3. Sendmail or SMTP : Sendmail

A. Update IMAP Settings : localhost:143 (uw)
B. Change Sendmail Config : /usr/sbin/sendmail

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>
you can leave other settings as same.

3.Configure Dovecot.
cd /etc/dovecot/
vi 10-mail.conf
mail_location = maildir:~/Maildir

vi 10-ssl.conf
ssl = yes

vi 10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain login

vi dovecot.conf
​protocols = imap pop3 lmtp
listen = *

#restart dovecot
#systemctl restart dovecot ; systemctl restart sendmail ; systemctl restart httpd.

Now you can access squirrel mail from https://localhost/webmail

After setting alias emails to other user if you want to see all root emails in new user mailbox then use command

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

or

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