This is my basic setup for Dovecot and Postfix under FreeBSD. I use LMTP for local mail delivery, that means all received email goes directly to an account on the system.
SMTP Authentication and secured connections with the server are also required.
All the mail is stored in a Maildir style folders.
- SMTP Authentication
- SSL/TLS Take a look on Let’s Encrypt for a free certificate
First of all you need to disable sendmail.
When done your file rc.conf should look like the following.
Now we can install whe required packages.
pkg install dovecot
pkg install postfix-sasl-3.3.1_1,1
The first file we need to modify is postfix main.cf. Be sure you have configured dovecot as your authentication mechanism for SMTP and your certificates are correctly set up and updated.
Set your domain correctly according to the domain you want to use for email.
In the first line you can check lmtp is the preferred mailbox transport.
myhostname = mail.yourdomain.com
mydomain = yourdomain.com
mailbox_transport = lmtp:unix:private/dovecot-lmtp
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
All the email addresses who had an empty header will have an email address like firstname.lastname@example.org.
Next be sure your dovecot is using the lmtp protocol.
# Protocols we want to be serving.
protocols = imap pop3 lmtp
Now we need to restart the servers.
service postfix restart
service dovecot restart
Thats all you need to get email working with a basic configuration, just to send and receive emails through your own domain.