Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2732,"date":"2019-12-11T00:45:25","date_gmt":"2019-12-11T00:45:25","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2732"},"modified":"2019-12-11T00:45:25","modified_gmt":"2019-12-11T00:45:25","slug":"simple-mailserver-with-postfix-dovecot-and-sieve-on-freebsd-10","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/simple-mailserver-with-postfix-dovecot-and-sieve-on-freebsd-10\/","title":{"rendered":"Simple Mailserver With Postfix, Dovecot, And Sieve On FreeBSD 10"},"content":{"rendered":"

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.<\/p>\n

In order to configure everything properly, first install these packages:<\/p>\n

pkg\r\npkg update -f\r\npkg install dovecot dovecot-managesieve postfix\r\n<\/code><\/pre>\n

When pkg asks you:<\/p>\n

Would you like to activate Postfix in \/etc\/mail\/mailer.conf [n]?\r\n<\/code><\/pre>\n

Answer with\u00a0y<\/code>.<\/p>\n

The first configuration step is done in\u00a0\/usr\/local\/etc\/dovecot.conf<\/code>. In the\u00a0protocol lda<\/code>\u00a0section, 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:<\/p>\n

postmaster_address = yourname@yourdomain.tld\r\nlda_mailbox_autocreate = yes\r\nlda_mailbox_autosubscribe = yes\r\n<\/code><\/pre>\n

The next step is to assign the correct path for your users’ mailboxes in the same file, under the\u00a0mail_location<\/code>\u00a0directive:<\/p>\n

mail_location = maildir:~\/Maildir\r\n<\/code><\/pre>\n

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:<\/p>\n

ssl = yes\r\nssl_cert = <\/path\/to\/your\/certificate\r\nssl_key = <\/path\/to\/your\/key\r\n<\/code><\/pre>\n

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\u00a0\/usr\/local\/etc\/postfix\/main.cf<\/code>:<\/p>\n

mailbox_command = \/usr\/local\/libexec\/dovecot\/deliver\r\nsmtpd_use_tls = no\r\nsmtpd_sasl_auth_enable = yes\r\nsmtpd_sasl_path        = private\/auth\r\nsmtpd_sasl_type        = dovecot\r\nsmtpd_recipient_restrictions =\r\n  permit_mynetworks,\r\n  permit_sasl_authenticated,\r\n  reject_unauth_destination\r\n<\/code><\/pre>\n

Next, add both services to\u00a0\/etc\/rc.conf<\/code>\u00a0and start them:<\/p>\n

echo \"postfix_enable=YES\" >> \/etc\/rc.conf\r\necho \"dovecot_enable=YES\" >> \/etc\/rc.conf\r\n\/usr\/local\/etc\/rc.d\/postfix start\r\n\/usr\/local\/etc\/rc.d\/dovecot start\r\n<\/code><\/pre>\n

Since it is considered rude to use the root-account for mailing, you should create a separate user for your mailing needs:<\/p>\n

 pw user add youruser -m\r\n passwd youruser\r\n<\/code><\/pre>\n

Inform postfix about the new user:<\/p>\n

newaliases\r\n<\/code><\/pre>\n

Now you can test the mail functionality with the following command:<\/p>\n

echo \"TEST\" | mail -s \"testmail\" youruser@localhost && tail -f \/var\/log\/maillog\r\n<\/code><\/pre>\n

If your log files contain a line similar to the following one (The last part is the important) ..<\/p>\n

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)\r\n<\/code><\/pre>\n

.. then everything is working properly.<\/p>\n

Sieve is automatically installed and configured by the\u00a0dovecot-managesieve<\/code>\u00a0package itself.<\/p>\n

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.<\/p>\n

Happy mailing!<\/p>\n

Other versions<\/h4>\n

Debian 7<\/strong><\/span><\/a><\/p>\n

CentOS 7<\/a><\/strong><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[230,244],"manual_kb_tag":[306,307,410],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2732"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2732"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2732\/revisions"}],"predecessor-version":[{"id":2733,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2732\/revisions\/2733"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2732"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2732"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}