 |
|
| |
| Introduction
| |
Running your own mail server lets your domain send and receive email under its own name. A complete
setup has three parts: a mail transfer agent (MTA) that sends and receives mail over SMTP, a
mailbox store that holds delivered mail and serves it to clients over IMAP/POP3, and the
clients people read mail with. This documentation uses Sendmail as the MTA and
Dovecot as the mailbox store on both FreeBSD 15 and Rocky Linux 10. Spam filtering
(SpamAssassin), virus
scanning (ClamAV), and webmail
(Roundcube) each have their
own pages.
| |
| Installing Sendmail and Dovecot
| |
On FreeBSD 15, the default system mailer is dma, a small send-only agent, and the
copy of Sendmail remaining in the base system is deprecated and built without the SASL support that
SMTP authentication (below) requires. Install the full Sendmail package alongside Dovecot, point the
system mailer at it, and start both:
# pkg install sendmail dovecot
# cp /usr/local/etc/mail/mailer.conf.sendmail /usr/local/etc/mail/mailer.conf
# sysrc sendmail_enable=YES
# sysrc sendmail_submit_enable=YES
# service sendmail start
# sysrc dovecot_enable=YES
# service dovecot start
On Rocky Linux 10, no MTA is installed by default; install Sendmail (packaged in
EPEL) and Dovecot, then make Sendmail the system mailer:
# dnf install epel-release
# dnf install sendmail sendmail-cf dovecot dovecot-pigeonhole
# alternatives --set mta /usr/sbin/sendmail.sendmail
# systemctl enable --now sendmail
# systemctl enable --now dovecot
| |
| Configuring Sendmail
| |
Sendmail is configured by editing a .mc macro file in /etc/mail and rebuilding —
the same directory on both systems. On FreeBSD, first tell the rebuild to use the Sendmail package's
configuration templates by adding one line to /etc/make.conf:
SENDMAIL_CF_DIR=/usr/local/share/sendmail/cf
After any change, rebuild and restart:
# FreeBSD: cd /etc/mail && make install restart
# Rocky Linux: make -C /etc/mail && systemctl restart sendmail
The pieces you will set up most often:
local-host-names — the domains this server accepts mail for.
Aliases (/etc/aliases, rebuilt with newaliases) — forward one local
address to another mailbox, to several recipients, or to an external address.
virtusertable — route addresses for hosted domains to specific mailboxes ("virtual
users"), so sales@example.com and sales@another.example can land in different
places.
access — allow or reject mail from particular senders, domains, or networks for
basic spam control.
| |
| Dovecot and SMTP Authentication
| |
Dovecot serves delivered mail to clients over IMAP and POP3 (use the SSL/TLS variants, IMAPS and
POP3S). It also provides the authentication that lets your users send mail through the server from
anywhere — "SMTP AUTH" — by exposing an auth socket that Sendmail consults. Dovecot's Sieve
plugin (the pigeonhole package on Rocky Linux) powers the server-side filters and vacation messages
that Roundcube sets up.
Two useful commands while configuring: doveconf -n prints the active configuration (omitting
defaults), and doveadm who lists who is currently connected.
| |
| Configuring Mail Clients
| |
Once the server is running, configure a desktop or phone mail client with: incoming IMAP (or POP3) on
your server's hostname using SSL/TLS; outgoing SMTP on the submission port (587) with SSL/TLS and
authentication turned on; and the user's full email address and password as credentials. Open the
matching ports in your firewall
(SMTP, submission, IMAPS, POP3S).
| |
| Documentation
| |
|
Toll Free 1-866-GSP-4400 • 1-301-464-9363 • service@gsp.com
Copyright © 1994-2026 GSP Services, Inc.
|