Repository: Mailu/Mailu

Issue:
fetchmail does not fetch mails in 2.0
<!--

Thank you for opening an issue with Mailu. Please understand that issues are meant for bugs and enhancement-requests.
For **user-support questions**, reach out to us  on [matrix](https://matrix.to/#/#mailu:tedomum.net).

To be able to help you best, we need some more information.

Before you open your issue
- Check if no issue or pull-request for this already exists.
- Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page)
- You understand `Mailu` is made by volunteers in their **free time** — be concise, civil and accept that delays can occur.
- The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title.

Please put your text outside of the comment blocks to be visible. You can use the button "Preview" above to check.

-->

## Environment & Version

### Environment

- [X] docker compose
- [ ] kubernetes
- [ ] docker swarm

### Version

- Version: 2.0, Container-"Id": "sha256:dd0a30f2ecb74491c49c8ab1b1d8d710eb55cc1e81d411acea9171ebd40ff314",

<!--
To find your version, get the image name of a mailu container and read  the version from the tag (example for version 1.7).

$> docker ps -a | grep mailu
140b09d4b09c    mailu/roundcube:1.7    "docker-php-entrypoi…"    2 weeks ago    Up 2 days (healthy)    80/tcp
$> grep MAILU_VERSION docker-compose.yml mailu.env
-->

## Description
<!--
Further explain the bug in a few words. It should be clear what the unexpected behaviour is.  Share it in an easy-to-understand language.
-->
After updating from 1.9 to 2.0 fetchmails does not fetch mails from remote POP3s-Servers. The container-logs contain the following information with log-level WARNING. Log-level DEBUG does not print more useful information

```
mailu-20-fetchmail-1  | Option --folder is not supported with POP3
mailu-20-fetchmail-1  | Option --folder is not supported with POP3
mailu-20-fetchmail-1  | Option --folder is not supported with POP3
mailu-20-fetchmail-1  | Sleeping for 1000 seconds
mailu-20-fetchmail-1  | fetchmail: Query status=5 (SYNTAX)
mailu-20-fetchmail-1  |
mailu-20-fetchmail-1  |
mailu-20-fetchmail-1  | fetchmail: Query status=5 (SYNTAX)
```
I copied the mailu.db and fired up the new stack based on the newly created configs and docker-compose.yml-files.

## Replication Steps
<!--
Steps for replicating your issue
-->
migrated DB from 1.9 copied to the new folder and starting the stack.

## Observed behaviour
<!--
Explain or paste the result you received.
-->
Any chance to get more detailed information from within the container?

## Expected behaviour
<!--
Explain what results you expected - be as specific as possible.
Just saying "it doesn’t work as expected" is not useful. It's also helpful to describe what you actually experienced.
-->
Fetching the remote mails and make them available in mailus mail-storage

## Logs
<!--
Often it is very useful to include log fragments of the involved component.
You can get the logs via `docker logs <container name> --tail 1000`.
For example for the admin container: `docker logs mailu_admin_1 --tail 1000`
or using docker compose `docker compose -f /mailu/docker-compose.yml logs --tail 1000 admin`

If you can find the relevant section, please share only the parts that seem relevant. If you have any logs, please enclose them in code tags, like so:

```
Your logs here!
```
-->



Discussion:
We can either find a way to enable MBOX (and assume the remote server supports it) or skip setting folders in the configuration file when we are configured to use pop3

https://sources.debian.org/src/fetchmail/6.3.26-3/pop3.c/#L978

Resolving patch:
diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py
--- a/optional/fetchmail/fetchmail.py
+++ b/optional/fetchmail/fetchmail.py
@@ -64,7 +64,7 @@ def run(debug):
                 username=escape_rc_string(fetch["username"]),
                 password=escape_rc_string(fetch["password"]),
                 options=options,
-                folders=folders,
+                folders='' if fetch['protocol'] == 'pop3' else folders,
                 lmtp='' if fetch['scan'] else 'lmtp',
             )
             if debug:


Test patch: