technicalguru / docker-mailserver-postfixadmin

Docker image for postfixadmin in mailserver project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for fetchmail.pl

tsvsj opened this issue · comments

From my understanding fetchmail via fetchmail.pl is currently not supported, because there is no cron installed in the image. This is a required feature for me and therefore, I would be really happy, if you could just add the cron package and a corresponding job to execute /var/www/html/ADDITIONS/fetchmail.pl once per minute (or with a configurable interval via ENV) into the image. 😃

Thanks!

Just for the interested ones: I've found a workaround, which seems to work smoothly as a first attempt:

fetchmail:
  image: volkerraschek/postfixadmin-fetchmail:latest
  environment:
    - DATABASE_TYPE=mysql
    - DATABASE_HOST=database.server
    - DATABASE_PORT=3306
    - DATABASE_NAME=mailserver
    - DATABASE_USER=mailserver_db_user
    - DATABASE_PASSWORD=mailserver_db_password
  volumes:
    - /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro
    - /etc/localtime:/etc/localtime:ro
fetchmail-restarter:
  image: docker
  volumes: 
    - "/var/run/docker.sock:/var/run/docker.sock"
  command:
    - "/bin/sh"
    - "-c"
    - "while true; do sleep 60; docker restart mailserver-fetchmail-1; done"
  restart: unless-stopped

The service fetchmail executes the fetchmail.pl once and then stops the service. Unfortunately the image doesnt make use of cron. However, the second service, fetchmail-restarter, uses an instance of docker to restart the actual fetchmail-service every 60 seconds.

As said, not the most elegant solution, but seems to work as a quick solution. 👍

btw I'm not the author of the image! Props to https://github.com/volker-raschek/postfixadmin-fetchmail-docker

Hello @tsvsj - what is your intention using fetchmail? As I couldn't get a clear picture by googling what it does, I need to understand the function first.

Did you check the docker-mailserver-roundcube? It provides the access to e-mails in a much better way.

fetchmail is used to grep emails from external sources via POP3. In my case I have a user, who still receives emails to an address from his old freemail provider. Those emails will be fetched by fetchmail.pl and are available in the INBOX of his IMAP account on my server.

Hmmm, wouldn't it make more sense to implement a forward rule there for all e-mails?

I will look into how this will be added to the image. (I remember that cron is not available in docker images)

Hmmm, wouldn't it make more sense to implement a forward rule there for all e-mails?

It is, like it is. A forward would change the presentation of the email (i.e. the timestamp). However, as Postfixadmin supports this service, I'd like to provide it via Docker as well... 😬

I will look into how this will be added to the image. (I remember that cron is not available in docker images)

I remember, that I saw images before, which make use of cron, but didn't tried it on my own yet. A quick search lead me to https://stackoverflow.com/questions/37015624/how-to-run-a-cron-job-inside-a-docker-container, which describes the job for alpine. Maybe that helps.

Thanks for your effort!