fetchmailmgr is a bridge between fetchmail and docker-mailserver. It fetches emails from external mail providers and delivers them to
the docker-mailserver. The configuration is managed by mailserver-admin, the management interface for docker-mailserver.
REDIS_URL: The URL of the Redis server. Default isredis://localhost:6379.TEMP_DIR: The directory used for temporary files. Default is/run/fetchmailmgr.FETCHMAIL_SMTP_ADDRESS: The SMTP address for mail delivery. Accepts host:port or just host. This variable is required.FETCHMAIL_USE_LMTP: Enable LMTP (Local Mail Transfer Protocol) for mail delivery. Acceptstrueorfalse. Default isfalse.FETCHMAIL_PATH: The path to thefetchmailexecutable. Default is/usr/bin/fetchmail.
-d, --debug: Output extra debugging information.-i, --interval <interval>: Interval in seconds to run fetchmail. Default is60.-s, --server <server>: Host to listen for health check requests. Default is0.0.0.0.-p, --port <port>: Port to listen for health check requests. Default is3000.
fetchmailmgr is a bridge between fetchmail and docker-mailserver. It fetches emails from external mail providers and delivers them to the docker-mailserver. The configuration is managed by mailserver-admin, the management interface for docker-mailserver.
-
Configuration: The configuration details for email accounts are stored in Redis under the key
fetchmail_accounts. These details are read and used to manage the fetching of emails. -
Account Object: The
accountobject represents the configuration details for an email account. It includes various properties that define how to connect to the email server and how to handle the emails. -
Fetching Emails: The
fetchmailmgruses thefetchmailexecutable to fetch emails from the configured email accounts. It constructs the necessary configuration files and executesfetchmailwith the appropriate arguments.
The account object has the following properties:
id: A unique identifier for the account.host: The hostname of the email server.protocol: The protocol used to connect to the email server (e.g.,IMAP,POP3).port: The port number to connect to the email server.username: The username for the email account.password: The password for the email account.ssl: A boolean indicating whether to use SSL or implicit TLS for the connection.verifySsl: A boolean indicating whether to verify the SSL certificate.user: The local user to deliver the emails to.
[
{
"id": 1,
"host": "mail.example.com",
"protocol": "IMAP",
"port": 993,
"username": "user@example.com",
"password": "password123",
"ssl": true,
"verifySsl": true,
"user": "localuser"
}
]The project includes a comprehensive test suite using Jest. To run the tests:
# Install dependencies
npm install
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage report
npm run test:coverageTo add a prefilled fetchmail_accounts key to Redis using docker compose, follow these steps:
Start the services:
docker-compose upPrefill the fetchmail_accounts key in Redis:
docker-compose exec redis redis-cli \
SET fetchmail_accounts '[{"id":1,"host":"mail.example.com","protocol":"IMAP","port":993,"username":"user@example.com","password":"password123","ssl":true,"verifySsl":true,"user":"localuser"}]'These commands will start the services and set the fetchmail_accounts key in Redis with the specified data.
This will put fetchmailmgr in a state where it will fetch emails from the specified email account.