• Domains
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • Cloud VPS
  • Dedicated Servers
  • Domains
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • Cloud VPS
  • Dedicated Servers
home/Knowledge Base/Dedicated Servers/Networking/Simple Mailserver With Postfix, Dovecot, And Sieve On FreeBSD 10
Popular Search:Dedicated Server, CentOS, Web Hosting

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

130 views 0 December 11, 2019 aklwebhost

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 = yourname@yourdomain.tld
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

Tags:And Sieve On FreeBSD 10DovecotSimple Mailserver With Postfix

Was this helpful?

Yes  No
Related Articles
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Setting up Munin for Monitoring on CentOS 6 x64
  • Setup a PPTP VPN Server on Ubuntu
  • Radio Streaming on FreeBSD 10 with IceCast and Ices
  • Stop DHCP From Changing resolv.conf
  • Setup Dynamic DNS For Windows Remote Desktop
Leave A Comment Cancel reply

Networking
  • Simple Mailserver With Postfix, Dovecot, And Sieve On FreeBSD 10
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Setting up Munin for Monitoring on CentOS 6 x64
  • Setup a PPTP VPN Server on Ubuntu
  • Stop DHCP From Changing resolv.conf
  • Setup Dynamic DNS For Windows Remote Desktop
View All 27  
Popular Articles
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Disabling SSDP (Linux / Windows)
  • Can I pay by Western Union?
  • Can a Coupon Code Discount Be Carried Forward While I Upgrade My VPS Account
  • Can I pay multiple due invoices using a single transaction?
KB Categories
  • Billing
  • Cloud Hosting
  • CMS Hosting
  • cPanel/WHM Control Panel Guide
  • Dedicated Servers
    • AMD Opteron 6272
    • Arch
    • Backup Storage
    • Bandwidth
    • Basic Security
    • BSD
    • CentOS
    • Containers
    • CoreOS
    • DDoS Protection
    • Debian
    • Dedicated Server Control Panel
    • Intel Core i5 3550
    • Intel Core i5 4570
    • Intel Core i7 3770
    • Intel Core i7 4770
    • Intel Xeon E3 1230 V3
    • Intel Xeon E3 1245 V2
    • IP Space
    • Linux Guides
    • Minecraft
    • Networking
    • Server Apps
    • Server Troubleshooting
    • Ubuntu
    • Windows Guides
    • Windows Server 2008
    • Windows Server 2012
  • Domain Names
  • Email Support Documentation
    • Setup IMAP or POP
    • User Features – How To
    • Webmail – How To
  • FTP (File Transfer Protocol
    • CuteFTP Guide
    • FileZilla Guide
  • Game Servers
  • MySQL and MariaDB
  • Node.js
  • Plesk Web Hosting Guide
  • VPS Server
  • Web Servers

  Setup XMPP Server With Prosody And FreeBSD

  • Privacy Policy
  • Terms of Use
  • © 2022 AKLWEB HOST LLC, All Rights Reserved.

Popular Search:Dedicated Server, CentOS, Web Hosting