diff --git a/README.md b/README.md index 3ca5ffc..e8f6267 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,12 @@ cd docker echo 'MAIL_DOMAIN=chat.example.org' > .env ``` + Optionally add a contact address for Let's Encrypt renewal notices: + + ```bash + echo 'ACME_EMAIL=admin@example.org' >> .env + ``` + The container generates a `chatmail.ini` with defaults from `MAIL_DOMAIN` on first start. To customize chatmail settings, mount your own `chatmail.ini` instead (see [Custom chatmail.ini](#custom-chatmailiini) below). diff --git a/docker-compose.yaml b/docker-compose.yaml index ad0a01c..ecf9a9d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -39,6 +39,7 @@ services: max-file: "3" environment: MAIL_DOMAIN: $MAIL_DOMAIN + ACME_EMAIL: ${ACME_EMAIL:-} network_mode: "host" volumes: ## system (required) diff --git a/env.example b/env.example index 3eebb37..1c7c227 100644 --- a/env.example +++ b/env.example @@ -1 +1,2 @@ MAIL_DOMAIN=chat.example.com +# ACME_EMAIL=admin@example.com diff --git a/scripts/chatmail-init.sh b/scripts/chatmail-init.sh index fc1015a..9b33578 100755 --- a/scripts/chatmail-init.sh +++ b/scripts/chatmail-init.sh @@ -41,6 +41,13 @@ if [ -n "${TLS_EXTERNAL_CERT_AND_KEY:-}" ]; then fi fi +# Inject ACME contact email from env var unless defined in chatmail.ini. +if [ -n "${ACME_EMAIL:-}" ]; then + if ! grep -q '^acme_email' "$CHATMAIL_INI"; then + echo "acme_email = $ACME_EMAIL" >> "$CHATMAIL_INI" + fi +fi + # Ensure mailboxes directory exists (chatmail-metadata needs it at startup, # but Dovecot only creates it on first mail delivery) mkdir -p "/home/vmail/mail/${MAIL_DOMAIN}"