Thanks to http://www.rosehosting.com/blog/install-and-configure-a-simple-mail-server-using-sendmail-and-dovecot-on-a-fedora-20-vps/
In the following article we will guide you through the steps of installing and configuring a simple mail server using Sendmail and Dovecot on aFedora 20 linux vps.
What is Sendmail?
It is a general purpose email routing facility that supports many kinds of mail-transfer and delivery methods, including the Simple Mail Transfer Protocol (SMTP) used for email transport over the Internet.
What is Dovecot?
Dovecot is an open source IMAP and POP3 server for Linux/UNIX-like systems. It can work with standard mbox, Maildir, and its own native high-performance dbox formats. It is fully compatible with UW IMAP and Courier IMAP servers’ implementation of them, as well as mail clients accessing the mailboxes directly. Dovecot also includes a Mail delivery agent (called Local delivery agent LDA) with optional Sieve filtering support.
UPDATE THE SYSTEM
Before proceeding any further, make sure you are in a screen session and check if your Fedora 20 linux vps is fully up-to-date by running:
## screen -U -S sendmail-screen ## yum update
INSTALL AND CONFIGURE SENDMAIL
Install Sendmail MTA using the following command
## yum install sendmail sendmail-cf sendmail-doc cyrus-sasl-{lib,plain}
change to /etc/mail
directory
## cd /etc/mail
edit sendmail’s sendmail.mc
configuration file and add/change the following
## cp sendmail.mc{,.orig} ## vim sendmail.mc
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl define(`confAUTH_OPTIONS', `A')dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(local_procmail)dnl DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl MAILER(procmail)dnl
save and close the file and make
sendmail’s configuration by running the following commands
## cd /etc/mail ## make all
restart sendmail and add it to your linux vps start-up using systemctl
## systemctl restart sendmail saslauthd ## systemctl enable sendmail saslauthd
for your convenience, below is the complete sendmail.mc
configuration file:
divert(-1)dnl include(`/usr/share/sendmail-cf/m4/cf.m4')dnl VERSIONID(`setup for linux')dnl OSTYPE(`linux')dnl define(`confDEF_USER_ID', ``8:12'')dnl define(`confTO_CONNECT', `1m')dnl define(`confTRY_NULL_MX_LIST', `True')dnl define(`confDONT_PROBE_INTERFACES', `True')dnl define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl define(`ALIAS_FILE', `/etc/aliases')dnl define(`STATUS_FILE', `/var/log/mail/statistics')dnl define(`UUCP_MAILER_MAX', `2000000')dnl define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl define(`confAUTH_OPTIONS', `A')dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl define(`confTO_IDENT', `0')dnl FEATURE(`no_default_msa', `dnl')dnl FEATURE(`smrsh', `/usr/sbin/smrsh')dnl FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl FEATURE(redirect)dnl FEATURE(always_add_domain)dnl FEATURE(use_cw_file)dnl FEATURE(use_ct_file)dnl FEATURE(local_procmail)dnl FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl FEATURE(`blacklist_recipients')dnl EXPOSED_USER(`root')dnl DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl FEATURE(`accept_unresolvable_domains')dnl LOCAL_DOMAIN(`localhost.localdomain')dnl MAILER(smtp)dnl MAILER(procmail)dnl
INSTALL AND CONFIGURE DOVECOT
Install dovecot
using the command below
## yum install dovecot
change to dovecot’s directory in /etc/dovecot
## cd /etc/dovecot
and edit the following
## vim conf.d/10-mail.conf ... mail_location = maildir:~/Maildir
## vim conf.d/10-ssl.conf ... ssl = yes
## vim conf.d/10-auth.conf ... disable_plaintext_auth = no auth_mechanisms = plain login
next, edit dovecot’s main configuration file and add/edit the following
## vim dovecot.conf ... protocols = imap pop3 lmtp listen = *
start Dovecot and add it to your Fedora system’s start-up using
## systemctl restart dovecot ## systemctl enable dovecot
SET-UP PROCMAIL
Add the following to /etc/procmailrc
## vim /etc/procmailrc DEFAULT=$HOME/Maildir/
CREATE A NEW USER
Create new user using the following command
## useradd -m test
set password for the newly created info
account
## passwd test
add your mydomain.com
domain name to /etc/mail/local-host-names
## echo mydomain.com >> /etc/mail/local-host-names
and create an alias for the newly created email account, by adding the following to/etc/mail/virtusertable
## vim /etc/mail/virtusertable test@mydomain.com test sales@mydomain.com test
rebuild sendmail’s configuration by running the following commands
## cd /etc/mail ## make all ## systemctl restart sendmail
Of course, if you are one of our VPS Hosting customers, you don’t have to do any of this, simply ask our admins, sit back and relax. Our admins will set this up for you immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.