content/blog/mail_server_alpine_postfix_dovecot_tutorial.md: add to dovecot section
This commit is contained in:
parent
5af37eb3c6
commit
ec99dbbcdc
1 changed files with 80 additions and 1 deletions
|
@ -447,7 +447,86 @@ Restart Postfix.
|
||||||
|
|
||||||
# Dovecot
|
# Dovecot
|
||||||
|
|
||||||
[Dovecot](https://www.dovecot.org/) is a popular IMAP and POP3 server which we'll be using for our MDA.
|
[Dovecot](https://www.dovecot.org/) is a popular IMAP and POP3 server which we'll be using for our MDA. Let's install
|
||||||
|
it:
|
||||||
|
|
||||||
|
# apk add dovecot
|
||||||
|
|
||||||
|
Check the Dovecot version with:
|
||||||
|
|
||||||
|
$ dovecot --version
|
||||||
|
|
||||||
|
Now let's enable IMAP by editing `/etc/dovecot/dovecot.conf`. Find a `protocols = ` line, or add one, and set it to:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
protocols = imap
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configure how to store emails
|
||||||
|
|
||||||
|
You probably want to use the Maildir format for storing emails, where each user's mail is stored at `~/Maildir` (this
|
||||||
|
can be set to another location if desired).
|
||||||
|
|
||||||
|
In `/etc/dovecot/conf.d/10-mail.conf`, set:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
mail_location = maildir:~/Maildir
|
||||||
|
mail_privileged_group = mail
|
||||||
|
```
|
||||||
|
|
||||||
|
`mail_privileged_group` tells us which group of Unix users can send mail; in this case, it's anyone in the `mail`
|
||||||
|
group. You can create the group with:
|
||||||
|
|
||||||
|
# addgroup mail
|
||||||
|
# adduser postfix mail
|
||||||
|
# adduser dovecot mail
|
||||||
|
|
||||||
|
We want to ensure that `postfix` and `dovecot` users have the right to access mail.
|
||||||
|
|
||||||
|
To change the Maildir directory, e.g. to set it to `~/mail`, you would set the following:
|
||||||
|
|
||||||
|
`/etc/dovecot/conf.d/10-mail.conf`:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
mail_location = maildir:~/mail
|
||||||
|
```
|
||||||
|
|
||||||
|
`/etc/postfix/main.cf`:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
home_mailbox = mail/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Get emails with LMTP
|
||||||
|
|
||||||
|
<abbr title="Local Mail Transfer Protocol">LMTP</abbr> is a protocol which can be used for Postfix to pass incoming
|
||||||
|
emails to Dovecot. To install it for Dovecot:
|
||||||
|
|
||||||
|
# apk add dovecot-lmtpd
|
||||||
|
|
||||||
|
Add `lmtp` to the supported protocols in `/etc/dovecot/dovecot.conf`:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
protocols = imap lmtp
|
||||||
|
```
|
||||||
|
|
||||||
|
Now change the LMTP service (or add if it isn't already there) in `/etc/dovecot/conf.d/10-master.conf` to:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
service lmtp {
|
||||||
|
unix_listener /var/spool/postfix/private/dovecot-lmtp {
|
||||||
|
mode = 0600
|
||||||
|
user = postfix
|
||||||
|
group = postfix
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Postfix needs to be configured to use this socket. Edit `/etc/postfix/main.cf` with the following lines:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
mailbox_transport = lmtp:unix:private/dovecot-lmtp
|
||||||
|
smtputf8_enable = no
|
||||||
|
```
|
||||||
|
|
||||||
<!-- FOOTNOTES: -->
|
<!-- FOOTNOTES: -->
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue