• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System BSD

Simple Mailserver With Postfix, Dovecot, And Sieve On FreeBSD 10

How VPS by How VPS
September 1, 2019
in BSD
0
0
SHARES
40
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Other versions
  2. Want to contribute?


This tutorial will show you how to get a simple mail server on FreeBSD 10, with Postfix as MTA, Dovecot as MDA and Sieve for sorting mail – all over an encrypted connection for improved security.

In order to configure everything properly, first install these packages:

pkg
pkg update -f
pkg install dovecot dovecot-managesieve postfix

When pkg asks you:

Would you like to activate Postfix in /etc/mail/mailer.conf [n]?

Answer with y.

The first configuration step is done in /usr/local/etc/dovecot.conf. In the protocol lda section, we will add a postmaster address so that people can contact you in case of a failure. Next, we will allow auto-creation of folders and auto-subscription of said folders to avoid an inconsistent state between your mail client and the server:

postmaster_address = [email protected]
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes

The next step is to assign the correct path for your users’ mailboxes in the same file, under the mail_location directive:

mail_location = maildir:~/Maildir

If the line already exists, comment it out and replace it with the one above. Now to configure encryption for IMAP. I assume that you already have a certificate in place:

ssl = yes
ssl_cert = </path/to/your/certificate
ssl_key = </path/to/your/key

The last step is to tell Postfix to deliver the mails via Dovecot, and also tell it to use SASL via Dovecot for authentication. Add the following lines to /usr/local/etc/postfix/main.cf:

mailbox_command = /usr/local/libexec/dovecot/deliver
smtpd_use_tls = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_path        = private/auth
smtpd_sasl_type        = dovecot
smtpd_recipient_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unauth_destination

Next, add both services to /etc/rc.conf and start them:

echo "postfix_enable=YES" >> /etc/rc.conf
echo "dovecot_enable=YES" >> /etc/rc.conf
/usr/local/etc/rc.d/postfix start
/usr/local/etc/rc.d/dovecot start

Since it is considered rude to use the root-account for mailing, you should create a separate user for your mailing needs:

 pw user add youruser -m
 passwd youruser

Inform postfix about the new user:

newaliases

Now you can test the mail functionality with the following command:

echo "TEST" | mail -s "testmail" youruser@localhost && tail -f /var/log/maillog

If your log files contain a line similar to the following one (The last part is the important) ..

postfix/local[27114]: 3F63C5B71: to=<youruser@localhost>, orig_to=<youruser@localhost>, relay=local, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (delivered to command: /usr/libexec/dovecot/deliver)

.. then everything is working properly.

Sieve is automatically installed and configured by the dovecot-managesieve package itself.

And that’s it. You can now log in via IMAP or POP3 in a secure fashion, send transport encrypted mails, and write filters with Sieve.

Happy mailing!

Other versions

Debian 7

CentOS 7

FreeBSD 10

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Install Reader Self 3.5 RSS Reader on a FreeBSD 11 FAMP VPS

Next Post

How to Install Matomo Analytics on FreeBSD 11

Next Post

How to Install Matomo Analytics on FreeBSD 11

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet