 |
|
| |
| 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, Sendmail is in the base system; install Dovecot, switch the system mailer
on, and start both:
# pkg install dovecot
# sysrc sendmail_enable=YES
# sysrc sendmail_submit_enable=YES
# service sendmail start
# sysrc dovecot_enable=YES
# service dovecot start
On Rocky Linux 10, the default MTA is Postfix; install Sendmail and Dovecot, then make
Sendmail the system mailer:
# dnf install sendmail sendmail-cf dovecot dovecot-pigeonhole
# systemctl disable --now postfix
# 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 and rebuilding — /usr/local/etc/mail
on FreeBSD, /etc/mail on Rocky Linux. After any change, rebuild and restart:
# FreeBSD: cd /usr/local/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.
|