For the past couple decades, I have had a hosted cPanel web account that includes an email server. This has been working well – but I have been dealing with storage capacity issues. My goal is to have docker-mailserver & fetchmail connect to the remote server, download messages and present them to clients that connect locally to dms. DMS will never be exposed to the public.
I have docker-mailserver installed and fetchmail is enabled. I have a user created in docker-mailserver and have successfully sent and received a test message to and from this account. I’ve obfuscated my domain name, username (remote and local) and password. But I’ve checked them 3 or 4 times to confirm I have them correct in my file.
poll 'mail.mydomain.com' proto imap
user 'user@mydomain.com'
pass 'pass'
is 'user@home.arpa'
ssl
--nokeep
This is what I’ve got in my compose.yaml file.
services:
mailserver:
image:
container_name: mailserver
# Provide the FQDN of your mail server here (Your DNS MX record should point to this value)
hostname:
env_file: mailserver.env
# More information about the mail-server ports:
#
ports:
- "25:25" # SMTP (explicit TLS => STARTTLS, Authentication is DISABLED => use port 465/587 instead)
- "143:143" # IMAP4 (explicit TLS => STARTTLS)
- "465:465" # ESMTP (implicit TLS)
- "587:587" # ESMTP (explicit TLS => STARTTLS)
- "993:993" # IMAP4 (implicit TLS)
volumes:
- /mnt/storage/mailserver/data/:/var/mail/
- /mnt/storage/mailserver/state/:/var/mail-state/
- /mnt/storage/mailserver/logs/:/var/log/mail/
- /mnt/storage/mailserver/config/:/tmp/docker-mailserver/
- /etc/localtime:/etc/localtime:ro
restart: always
stop_grace_period: 1m
# Uncomment if using `ENABLE_FAIL2BAN=1`:
# cap_add:
# - NET_ADMIN
healthcheck:
test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1"
timeout: 3s
retries: 0ghcr.io/docker-mailserver/docker-mailserver:latest10.10.0.10https://docker-mailserver.github.io/docker-mailserver/latest/config/security/understanding-the-ports/
This is a screenshot taken from portainer to show the environment variables related to fetchmail – I thought it would be easier to see them this way.
https://imgur.com/a/yO6j4vu