Required Environment Variables:

  • SSL_TYPE=letsencrypt

  • ENABLE_DNS_CHALLENGE=1

  • DNS_PROVIDER=dns_cf

  • PROVIDER_CONFIG=CF_Token=

  • OVERRIDE_HOSTNAME=mail.zoomdang.com

You must get a cloudflare API token. Go to cloudflare, generate an account API tokens, give permission to editi zone DNS for the specific domain.

Docker-Mailserver often crashes if it doesn’t find a certificate folder before the challenge finishes. We solved this by:

  1. Creating the folder manually on the host: /mail_certificate/live/mail.zoomdang.com.

  2. Mounting it directly: /mail_certificate:/etc/letsencrypt:rw.

  3. Adding ONE_DIR=1 to the environment to ensure persistence.

Remember to do port forwarding in local router

Copy to Clipboard
Copy to Clipboard

acme.sh isn’t active in the container by default. You must download it, run it.
Use Cloudflare token to solve DNS challange.
Move .pem file into the /etc/letsencrypt/live/

Final Guide: Real-Time Mail “Vacuum” (IDLE) Setup

This setup ensures your Dell 5810 fetches mail from Purelymail instantly and survives container restarts.

1. The “Golden” Configuration

The configuration must include the `mda` fix (to bypass permission issues) and the `idle` command (for real-time sync).

File Content:

“`

poll imap.purelymail.com with proto IMAP

       user ‘[email protected]‘ there with password ‘jjbmycwahtceldiccbav’ is ‘[email protected]‘ here options ssl

       mda “/usr/sbin/sendmail -i -f %F %T”

       idle

“`

2. Making it “Restart-Proof”

Docker-Mailserver (DMS) regenerates the internal config on every boot. To make our changes stick, we placed the config in the official DMS override location:

• Path: `/tmp/docker-mailserver/fetchmail.cf`

• Logic: On startup, DMS checks this file. If it exists, it uses these settings to build the active `/etc/fetchmailrc` file.

3. Key Technical Fixes Applied

• MDA Bypass: Changed delivery from the default (Dovecot) to `sendmail`. This avoids the “nonzero status 75” error caused by internal container permission mismatches.

• User Ownership: Ensured the configuration is owned by the `fetchmail` user. Fetchmail will refuse to run if the config file is owned by `root`.

• Single Process: Verified that only the official system daemon is running to avoid session conflicts with Purelymail.

4. Coolify Environment Variables

Set these in the Coolify UI to support the background process:

• `ENABLE_FETCHMAIL=1`

• `FETCHMAIL_POLL=300` (This acts as a 5-minute “heartbeat” to reconnect if the IDLE connection ever drops).

5. Quick Health Check Commands

• Check process: `ps aux | grep fetchmail` (Should show exactly one process).

• Check logs: `tail -f /var/log/mail.log` (Look for `fetchmail: IMAP< + Idling`).

• Force Update: `pkill fetchmail` (The system will automatically restart it with the latest config).

Share This Story, Choose Your Platform!

About the author : Zoom N. Dang

Leave A Comment