mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-06-24 17:58:58 +02:00
Update README.md (#2425)
Co-authored-by: casperklein <casperklein@users.noreply.github.com>
This commit is contained in:
parent
b61dfe1e24
commit
d858669dd4
3 changed files with 2 additions and 2 deletions
|
@ -0,0 +1,112 @@
|
|||
---
|
||||
title: 'Use Cases | Forward-Only Mail-Server with LDAP'
|
||||
---
|
||||
|
||||
## Building a Forward-Only Mail-Server
|
||||
|
||||
A **forward-only** mail-server does not have any local mailboxes. Instead, it has only aliases that forward emails to external email accounts (for example to a Gmail account). You can also send email from the localhost (the computer where `docker-mailserver` is installed), using as sender any of the alias addresses.
|
||||
|
||||
The important settings for this setup (on `mailserver.env`) are these:
|
||||
|
||||
```env
|
||||
PERMIT_DOCKER=host
|
||||
ENABLE_POP3=
|
||||
ENABLE_CLAMAV=0
|
||||
SMTP_ONLY=1
|
||||
ENABLE_SPAMASSASSIN=0
|
||||
ENABLE_FETCHMAIL=0
|
||||
```
|
||||
|
||||
Since there are no local mailboxes, we use `SMTP_ONLY=1` to disable `dovecot`. We disable as well the other services that are related to local mailboxes (`POP3`, `ClamAV`, `SpamAssassin`, etc.)
|
||||
|
||||
We can create aliases with `./setup.sh`, like this:
|
||||
|
||||
```sh
|
||||
./setup.sh alias add <alias-address> <external-email-account>
|
||||
```
|
||||
|
||||
## Authenticating with LDAP
|
||||
|
||||
If you want to send emails from outside the mail-server you have to authenticate somehow (with a username and password). One way of doing it is described in [this discussion][github-issue-1247]. However if there are many user accounts, it is better to use authentication with LDAP. The settings for this on `mailserver.env` are:
|
||||
|
||||
```env
|
||||
ENABLE_LDAP=1
|
||||
LDAP_START_TLS=yes
|
||||
LDAP_SERVER_HOST=ldap.example.org
|
||||
LDAP_SEARCH_BASE=ou=users,dc=example,dc=org
|
||||
LDAP_BIND_DN=cn=mailserver,dc=example,dc=org
|
||||
LDAP_BIND_PW=pass1234
|
||||
|
||||
ENABLE_SASLAUTHD=1
|
||||
SASLAUTHD_MECHANISMS=ldap
|
||||
SASLAUTHD_LDAP_SERVER=ldap.example.org
|
||||
SASLAUTHD_LDAP_START_TLS=yes
|
||||
SASLAUTHD_LDAP_BIND_DN=cn=mailserver,dc=example,dc=org
|
||||
SASLAUTHD_LDAP_PASSWORD=pass1234
|
||||
SASLAUTHD_LDAP_SEARCH_BASE=ou=users,dc=example,dc=org
|
||||
SASLAUTHD_LDAP_FILTER=(&(uid=%U)(objectClass=inetOrgPerson))
|
||||
```
|
||||
|
||||
My LDAP data structure is very basic, containing only the username, password, and the external email address where to forward emails for this user. An entry looks like this:
|
||||
|
||||
```properties
|
||||
add uid=username,ou=users,dc=example,dc=org
|
||||
uid: username
|
||||
objectClass: inetOrgPerson
|
||||
sn: username
|
||||
cn: username
|
||||
userPassword: {SSHA}abcdefghi123456789
|
||||
email: external-account@gmail.com
|
||||
```
|
||||
|
||||
This structure is different from what is expected/assumed from the configuration scripts of `docker-mailserver`, so it doesn't work just by using the `LDAP_QUERY_FILTER_...` settings. Instead, I had to use a custom configuration ([via `user-patches.sh`][docs-userpatches]). I created the script `docker-data/dms/config/user-patches.sh`, with content like this:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
rm -f /etc/postfix/{ldap-groups.cf,ldap-domains.cf}
|
||||
|
||||
postconf \
|
||||
"virtual_mailbox_domains = /etc/postfix/vhost" \
|
||||
"virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf texthash:/etc/postfix/virtual" \
|
||||
"smtpd_sender_login_maps = ldap:/etc/postfix/ldap-users.cf"
|
||||
|
||||
sed -i /etc/postfix/ldap-users.cf \
|
||||
-e '/query_filter/d' \
|
||||
-e '/result_attribute/d' \
|
||||
-e '/result_format/d'
|
||||
cat <<EOF >> /etc/postfix/ldap-users.cf
|
||||
query_filter = (uid=%u)
|
||||
result_attribute = uid
|
||||
result_format = %s@example.org
|
||||
EOF
|
||||
|
||||
sed -i /etc/postfix/ldap-aliases.cf \
|
||||
-e '/domain/d' \
|
||||
-e '/query_filter/d' \
|
||||
-e '/result_attribute/d'
|
||||
cat <<EOF >> /etc/postfix/ldap-aliases.cf
|
||||
domain = example.org
|
||||
query_filter = (uid=%u)
|
||||
result_attribute = mail
|
||||
EOF
|
||||
|
||||
postfix reload
|
||||
```
|
||||
|
||||
You see that besides `query_filter`, I had to customize as well `result_attribute` and `result_format`.
|
||||
|
||||
!!! note "See also"
|
||||
|
||||
For more details about using LDAP see: [LDAP managed mail-server with Postfix and Dovecot for multiple domains](https://www.vennedey.net/resources/2-LDAP-managed-mail-server-with-Postfix-and-Dovecot-for-multiple-domains)
|
||||
|
||||
!!! note
|
||||
|
||||
Another solution that serves as a forward-only mail-server is [this](https://gitlab.com/docker-scripts/postfix).
|
||||
|
||||
!!! tip
|
||||
|
||||
One user reports only having success if `ENABLE_LDAP=0` was set.
|
||||
|
||||
[docs-userpatches]: ../../config/advanced/override-defaults/user-patches.md
|
||||
[github-issue-1247]: https://github.com/docker-mailserver/docker-mailserver/issues/1247
|
72
docs/content/examples/use-cases/imap-folders.md
Normal file
72
docs/content/examples/use-cases/imap-folders.md
Normal file
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
title: 'Use Cases | Customize Mailbox Folders'
|
||||
hide:
|
||||
- toc # Hide Table of Contents for this page
|
||||
---
|
||||
|
||||
# Mailboxes (_aka IMAP Folders_)
|
||||
|
||||
`INBOX` is setup as the private [`inbox` namespace][dovecot-docs-namespaces]. By default [`target/dovecot/15-mailboxes.conf`][gh-config-dovecot-mailboxes] configures the special IMAP folders `Drafts`, `Sent`, `Junk` and `Trash` to be automatically created and subscribed. They are all assigned to the private [`inbox` namespace][dovecot-docs-namespaces] (_which implicitly provides the `INBOX` folder_).
|
||||
|
||||
These IMAP folders are considered special because they add a [_"SPECIAL-USE"_ attribute][rfc-6154], which is a standardized way to communicate to mail clients that the folder serves a purpose like storing spam/junk mail (`\Junk`) or deleted mail (`\Trash`). This differentiates them from regular mail folders that you may use for organizing.
|
||||
|
||||
## Adding a mailbox folder
|
||||
|
||||
See [`target/dovecot/15-mailboxes.conf`][gh-config-dovecot-mailboxes] for existing mailbox folders which you can modify or uncomment to enable some other common mailboxes. For more information try the [official Dovecot documentation][dovecot-docs-mailboxes].
|
||||
|
||||
The `Archive` special IMAP folder may be useful to enable. To do so, make a copy of [`target/dovecot/15-mailboxes.conf`][gh-config-dovecot-mailboxes] and uncomment the `Archive` mailbox definition. Mail clients should understand that this folder is intended for archiving mail due to the [`\Archive` _"SPECIAL-USE"_ attribute][rfc-6154].
|
||||
|
||||
With the provided [docker-compose.yml][gh-config-dockercompose] example, a volume bind mounts the host directory `docker-data/dms/config/` to the container location `/tmp/docker-mailserver/`. Config file overrides should instead be mounted to a different location as described in [Overriding Configuration for Dovecot][docs-config-overrides-dovecot]:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- ./docker-data/dms/config/dovecot/15-mailboxes.conf:/etc/dovecot/conf.d/15-mailboxes.conf:ro
|
||||
```
|
||||
|
||||
## Caution
|
||||
|
||||
### Adding folders to an existing setup
|
||||
|
||||
Handling of newly added mailbox folders can be inconsistent across mail clients:
|
||||
|
||||
- Users may experience issues such as archived emails only being available locally.
|
||||
- Users may need to migrate emails manually between two folders.
|
||||
|
||||
### Support for `SPECIAL-USE` attributes
|
||||
|
||||
Not all mail clients support the `SPECIAL-USE` attribute for mailboxes (_defined in [RFC 6154][rfc-6154]_). These clients will treat the mailbox folder as any other, using the name assigned to it instead.
|
||||
|
||||
Some clients may still know to treat these folders for their intended purpose if the mailbox name matches the common names that the `SPECIAL-USE` attributes represent (_eg `Sent` as the mailbox name for `\Sent`_).
|
||||
|
||||
### Internationalization (i18n)
|
||||
|
||||
Usually the mail client will know via context such as the `SPECIAL-USE` attribute or common English mailbox names, to provide a localized label for the users preferred language.
|
||||
|
||||
Take care to test localized names work well as well.
|
||||
|
||||
### Email Clients Support
|
||||
|
||||
- If a new mail account is added without the `SPECIAL-USE` attribute enabled for archives:
|
||||
- **Thunderbird** suggests and may create an `Archives` folder on the server.
|
||||
- **Outlook for Android** archives to a local folder.
|
||||
- **Spark for Android** archives to server folder named `Archive`.
|
||||
- If a new mail account is added after the `SPECIAL-USE` attribute is enabled for archives:
|
||||
- **Thunderbird**, **Outlook for Android** and **Spark for Android** will use the mailbox folder name assigned.
|
||||
|
||||
!!! caution "Windows Mail"
|
||||
|
||||
**Windows Mail** has been said to ignore `SPECIAL-USE` attribute and look only at the mailbox folder name assigned.
|
||||
|
||||
!!! note "Needs citation"
|
||||
|
||||
This information is provided by the community.
|
||||
|
||||
It presently lacks references to confirm the behaviour. If any information is incorrect please let us know! :smile:
|
||||
|
||||
|
||||
[docs-config-overrides-dovecot]: ../../config/advanced/override-defaults/dovecot.md#override-configuration
|
||||
[gh-config-dockercompose]: https://github.com/docker-mailserver/docker-mailserver/blob/master/docker-compose.yml
|
||||
[gh-config-dovecot-mailboxes]: https://github.com/docker-mailserver/docker-mailserver/blob/master/target/dovecot/15-mailboxes.conf
|
||||
[dovecot-docs-namespaces]: https://doc.dovecot.org/configuration_manual/namespace/#namespace-inbox
|
||||
[dovecot-docs-mailboxes]: https://doc.dovecot.org/configuration_manual/namespace/#mailbox-settings
|
||||
[rfc-6154]: https://datatracker.ietf.org/doc/html/rfc6154
|
Loading…
Add table
Add a link
Reference in a new issue