The following tutorial describes how to set up a simple mailserver using Postfix as MTA, Dovecot as MDA<\/strong>\u00a0and the awesome Sieve for sorting mails. The starting point is a\u00a0freshly installed server with Debian<\/strong>\u00a0on which you have got either access to the administrative user or sudo rights.<\/p>\n First, install the necessary packages:<\/strong><\/p>\n During the installation process,<\/strong>\u00a0you will be asked\u00a0what sort of server<\/strong>\u00a0you are running and\u00a0how Postfix will receive send and receive mails.<\/strong>\u00a0Select “Internet Site<\/strong>” here.<\/p>\n The first configuration step<\/strong>\u00a0is to\u00a0connect Dovecot with Postfix<\/strong>\u00a0and setup up a postmaster address, this is the address that others will see when mail delivery failed, so they can contact you on eventual problems on your end. Open\u00a0 In the same file,\u00a0also activate the automatic creation and subscription<\/strong>\u00a0to folders you generate via IMAP:<\/p>\n The next step is to configure the spot<\/strong>\u00a0on the filesystem where the\u00a0mails should be stored<\/strong>. Open\u00a0 Make sure that every other mention<\/strong>\u00a0of\u00a0 After restarting both services …<\/strong><\/p>\n … you can test if everything is working by issuing the following command:<\/strong><\/p>\n If\u00a0everything is working properly<\/strong>\u00a0you should\u00a0find a message similar<\/strong>\u00a0to the following one in\u00a0sudo apt-get install postfix dovecot-imapd dovecot-managesieved\r\n<\/code><\/pre>\n
\/etc\/dovecot\/conf.d\/15-lda.conf<\/code>\u00a0and edit the following line:<\/p>\n
postmaster_address = yourname@yourdomain.tld\r\n<\/code><\/pre>\n
lda_mailbox_autocreate = yes\r\nlda_mailbox_autosubscribe = yes\r\n<\/code><\/pre>\n
\/etc\/dovecot\/conf.d\/10-mail.conf<\/code>\u00a0and\u00a0edit the following lines:<\/strong><\/p>\n
mail_location = maildir:~\/Maildir\r\n<\/code><\/pre>\n
mail_location<\/code>\u00a0is commented out in this context.\u00a0Now you can tell Postfix<\/strong>\u00a0to hand\u00a0over incoming mails to Dovecot<\/strong>\u00a0by editing\u00a0
\/etc\/postfix\/main.cf<\/code>, adding the following line:<\/p>\n
mailbox_command = \/usr\/lib\/dovecot\/deliver\r\n<\/code><\/pre>\n
sudo service postfix restart\r\nsudo service dovecot restart\r\n<\/code><\/pre>\n
echo \"Testmail!\" | mail -s \"Testmail!\" root@localhost\r\n<\/code><\/pre>\n
\/var\/log\/mail.log<\/code>:<\/p>\n
install postfix\/local[10309]: A0B361DDA2: to=<root@localhost>, relay=local, delay=0.02, delays=0.01\/0\/0\/0.01, dsn=2.0.0, status=sent (delivered to command: \/usr\/lib\/dovecot\/deliver\r\n<\/code><\/pre>\n