Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for fetchmail.pl #13

Open
tsvsj opened this issue Nov 20, 2023 · 5 comments
Open

Support for fetchmail.pl #13

tsvsj opened this issue Nov 20, 2023 · 5 comments

Comments

@tsvsj
Copy link

tsvsj commented Nov 20, 2023

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!

@tsvsj
Copy link
Author

tsvsj commented Nov 21, 2023

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

@technicalguru
Copy link
Owner

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.

@tsvsj
Copy link
Author

tsvsj commented Nov 21, 2023

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.

@technicalguru
Copy link
Owner

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)

@tsvsj
Copy link
Author

tsvsj commented Nov 21, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants