We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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!
```
-->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `optional/fetchmail/fetchmail.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 import time
4 import os
5 from pathlib import Path
6 from pwd import getpwnam
7 import tempfile
8 import shlex
9 import subprocess
10 import requests
11 from socrate import system
12 import sys
13 import traceback
14 
15 
16 FETCHMAIL = """
17 fetchmail -N \
18     --idfile /data/fetchids --uidl \
19     --pidfile /dev/shm/fetchmail.pid \
20     --sslcertck --sslcertpath /etc/ssl/certs \
21     -f {}
22 """
23 
24 
25 RC_LINE = """
26 poll "{host}" proto {protocol}  port {port}
27     user "{username}" password "{password}"
28     is "{user_email}"
29     smtphost "{smtphost}"
30     {folders}
31     {options}
32     {lmtp}
33 """
34 
35 
36 def escape_rc_string(arg):
37     return "".join("\\x%2x" % ord(char) for char in arg)
38 
39 
40 def fetchmail(fetchmailrc):
41     with tempfile.NamedTemporaryFile() as handler:
42         handler.write(fetchmailrc.encode("utf8"))
43         handler.flush()
44         command = FETCHMAIL.format(shlex.quote(handler.name))
45         output = subprocess.check_output(command, shell=True)
46         return output
47 
48 
49 def run(debug):
50     try:
51         fetches = requests.get(f"http://{os.environ['ADMIN_ADDRESS']}:8080/internal/fetch").json()
52         for fetch in fetches:
53             fetchmailrc = ""
54             options = "options antispam 501, 504, 550, 553, 554"
55             options += " ssl" if fetch["tls"] else ""
56             options += " keep" if fetch["keep"] else " fetchall"
57             folders = "folders %s" % ((','.join('"' + item + '"' for item in fetch['folders'])) if fetch['folders'] else '"INBOX"')
58             fetchmailrc += RC_LINE.format(
59                 user_email=escape_rc_string(fetch["user_email"]),
60                 protocol=fetch["protocol"],
61                 host=escape_rc_string(fetch["host"]),
62                 port=fetch["port"],
63                 smtphost=f'{os.environ["FRONT_ADDRESS"]}' if fetch['scan'] else f'{os.environ["FRONT_ADDRESS"]}/2525',
64                 username=escape_rc_string(fetch["username"]),
65                 password=escape_rc_string(fetch["password"]),
66                 options=options,
67                 folders=folders,
68                 lmtp='' if fetch['scan'] else 'lmtp',
69             )
70             if debug:
71                 print(fetchmailrc)
72             try:
73                 print(fetchmail(fetchmailrc))
74                 error_message = ""
75             except subprocess.CalledProcessError as error:
76                 error_message = error.output.decode("utf8")
77                 # No mail is not an error
78                 if not error_message.startswith("fetchmail: No mail"):
79                     print(error_message)
80                 user_info = "for %s at %s" % (fetch["user_email"], fetch["host"])
81                 # Number of messages seen is not a error as well
82                 if ("messages" in error_message and
83                         "(seen " in error_message and
84                         user_info in error_message):
85                     print(error_message)
86             finally:
87                 requests.post("http://{}:8080/internal/fetch/{}".format(os.environ['ADMIN_ADDRESS'],fetch['id']),
88                     json=error_message.split('\n')[0]
89                 )
90     except Exception:
91         traceback.print_exc()
92 
93 
94 if __name__ == "__main__":
95     id_fetchmail = getpwnam('fetchmail')
96     Path('/data/fetchids').touch()
97     os.chown("/data/fetchids", id_fetchmail.pw_uid, id_fetchmail.pw_gid)
98     os.chown("/data/", id_fetchmail.pw_uid, id_fetchmail.pw_gid)
99     os.chmod("/data/fetchids", 0o700)
100     system.drop_privs_to('fetchmail')
101     config = system.set_env()
102     while True:
103         delay = int(os.environ.get('FETCHMAIL_DELAY', 60))
104         print("Sleeping for {} seconds".format(delay))
105         time.sleep(delay)
106 
107         if not config.get('FETCHMAIL_ENABLED', True):
108             print("Fetchmail disabled, skipping...")
109             continue
110 
111         run(config.get('DEBUG', False))
112         sys.stdout.flush()
113
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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 @@
                 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:

{"golden_diff": "diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py\n--- a/optional/fetchmail/fetchmail.py\n+++ b/optional/fetchmail/fetchmail.py\n@@ -64,7 +64,7 @@\n                 username=escape_rc_string(fetch[\"username\"]),\n                 password=escape_rc_string(fetch[\"password\"]),\n                 options=options,\n-                folders=folders,\n+                folders='' if fetch['protocol'] == 'pop3' else folders,\n                 lmtp='' if fetch['scan'] else 'lmtp',\n             )\n             if debug:\n", "issue": "fetchmail does not fetch mails in 2.0\n<!--\r\n\r\nThank you for opening an issue with Mailu. Please understand that issues are meant for bugs and enhancement-requests.\r\nFor **user-support questions**, reach out to us  on [matrix](https://matrix.to/#/#mailu:tedomum.net).\r\n\r\nTo be able to help you best, we need some more information.\r\n\r\nBefore you open your issue\r\n- Check if no issue or pull-request for this already exists.\r\n- Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page)\r\n- You understand `Mailu` is made by volunteers in their **free time** \u2014 be concise, civil and accept that delays can occur.\r\n- 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.\r\n\r\nPlease put your text outside of the comment blocks to be visible. You can use the button \"Preview\" above to check.\r\n\r\n-->\r\n\r\n## Environment & Version\r\n\r\n### Environment\r\n\r\n- [X] docker compose\r\n- [ ] kubernetes\r\n- [ ] docker swarm\r\n\r\n### Version\r\n\r\n- Version: 2.0, Container-\"Id\": \"sha256:dd0a30f2ecb74491c49c8ab1b1d8d710eb55cc1e81d411acea9171ebd40ff314\",\r\n\r\n<!--\r\nTo find your version, get the image name of a mailu container and read  the version from the tag (example for version 1.7).\r\n\r\n$> docker ps -a | grep mailu\r\n140b09d4b09c    mailu/roundcube:1.7    \"docker-php-entrypoi\u2026\"    2 weeks ago    Up 2 days (healthy)    80/tcp\r\n$> grep MAILU_VERSION docker-compose.yml mailu.env\r\n-->\r\n\r\n## Description\r\n<!--\r\nFurther explain the bug in a few words. It should be clear what the unexpected behaviour is.  Share it in an easy-to-understand language.\r\n-->\r\nAfter 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\r\n\r\n```\r\nmailu-20-fetchmail-1  | Option --folder is not supported with POP3\r\nmailu-20-fetchmail-1  | Option --folder is not supported with POP3\r\nmailu-20-fetchmail-1  | Option --folder is not supported with POP3\r\nmailu-20-fetchmail-1  | Sleeping for 1000 seconds\r\nmailu-20-fetchmail-1  | fetchmail: Query status=5 (SYNTAX)\r\nmailu-20-fetchmail-1  |\r\nmailu-20-fetchmail-1  |\r\nmailu-20-fetchmail-1  | fetchmail: Query status=5 (SYNTAX)\r\n```\r\nI copied the mailu.db and fired up the new stack based on the newly created configs and docker-compose.yml-files.\r\n\r\n## Replication Steps\r\n<!--\r\nSteps for replicating your issue\r\n-->\r\nmigrated DB from 1.9 copied to the new folder and starting the stack.\r\n\r\n## Observed behaviour\r\n<!--\r\nExplain or paste the result you received.\r\n-->\r\nAny chance to get more detailed information from within the container?\r\n\r\n## Expected behaviour\r\n<!--\r\nExplain what results you expected - be as specific as possible.\r\nJust saying \"it doesn\u2019t work as expected\" is not useful. It's also helpful to describe what you actually experienced.\r\n-->\r\nFetching the remote mails and make them available in mailus mail-storage\r\n\r\n## Logs\r\n<!--\r\nOften it is very useful to include log fragments of the involved component.\r\nYou can get the logs via `docker logs <container name> --tail 1000`.\r\nFor example for the admin container: `docker logs mailu_admin_1 --tail 1000`\r\nor using docker compose `docker compose -f /mailu/docker-compose.yml logs --tail 1000 admin`\r\n\r\nIf 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:\r\n\r\n```\r\nYour logs here!\r\n```\r\n-->\r\n\n", "before_files": [{"content": "#!/usr/bin/env python3\n\nimport time\nimport os\nfrom pathlib import Path\nfrom pwd import getpwnam\nimport tempfile\nimport shlex\nimport subprocess\nimport requests\nfrom socrate import system\nimport sys\nimport traceback\n\n\nFETCHMAIL = \"\"\"\nfetchmail -N \\\n    --idfile /data/fetchids --uidl \\\n    --pidfile /dev/shm/fetchmail.pid \\\n    --sslcertck --sslcertpath /etc/ssl/certs \\\n    -f {}\n\"\"\"\n\n\nRC_LINE = \"\"\"\npoll \"{host}\" proto {protocol}  port {port}\n    user \"{username}\" password \"{password}\"\n    is \"{user_email}\"\n    smtphost \"{smtphost}\"\n    {folders}\n    {options}\n    {lmtp}\n\"\"\"\n\n\ndef escape_rc_string(arg):\n    return \"\".join(\"\\\\x%2x\" % ord(char) for char in arg)\n\n\ndef fetchmail(fetchmailrc):\n    with tempfile.NamedTemporaryFile() as handler:\n        handler.write(fetchmailrc.encode(\"utf8\"))\n        handler.flush()\n        command = FETCHMAIL.format(shlex.quote(handler.name))\n        output = subprocess.check_output(command, shell=True)\n        return output\n\n\ndef run(debug):\n    try:\n        fetches = requests.get(f\"http://{os.environ['ADMIN_ADDRESS']}:8080/internal/fetch\").json()\n        for fetch in fetches:\n            fetchmailrc = \"\"\n            options = \"options antispam 501, 504, 550, 553, 554\"\n            options += \" ssl\" if fetch[\"tls\"] else \"\"\n            options += \" keep\" if fetch[\"keep\"] else \" fetchall\"\n            folders = \"folders %s\" % ((','.join('\"' + item + '\"' for item in fetch['folders'])) if fetch['folders'] else '\"INBOX\"')\n            fetchmailrc += RC_LINE.format(\n                user_email=escape_rc_string(fetch[\"user_email\"]),\n                protocol=fetch[\"protocol\"],\n                host=escape_rc_string(fetch[\"host\"]),\n                port=fetch[\"port\"],\n                smtphost=f'{os.environ[\"FRONT_ADDRESS\"]}' if fetch['scan'] else f'{os.environ[\"FRONT_ADDRESS\"]}/2525',\n                username=escape_rc_string(fetch[\"username\"]),\n                password=escape_rc_string(fetch[\"password\"]),\n                options=options,\n                folders=folders,\n                lmtp='' if fetch['scan'] else 'lmtp',\n            )\n            if debug:\n                print(fetchmailrc)\n            try:\n                print(fetchmail(fetchmailrc))\n                error_message = \"\"\n            except subprocess.CalledProcessError as error:\n                error_message = error.output.decode(\"utf8\")\n                # No mail is not an error\n                if not error_message.startswith(\"fetchmail: No mail\"):\n                    print(error_message)\n                user_info = \"for %s at %s\" % (fetch[\"user_email\"], fetch[\"host\"])\n                # Number of messages seen is not a error as well\n                if (\"messages\" in error_message and\n                        \"(seen \" in error_message and\n                        user_info in error_message):\n                    print(error_message)\n            finally:\n                requests.post(\"http://{}:8080/internal/fetch/{}\".format(os.environ['ADMIN_ADDRESS'],fetch['id']),\n                    json=error_message.split('\\n')[0]\n                )\n    except Exception:\n        traceback.print_exc()\n\n\nif __name__ == \"__main__\":\n    id_fetchmail = getpwnam('fetchmail')\n    Path('/data/fetchids').touch()\n    os.chown(\"/data/fetchids\", id_fetchmail.pw_uid, id_fetchmail.pw_gid)\n    os.chown(\"/data/\", id_fetchmail.pw_uid, id_fetchmail.pw_gid)\n    os.chmod(\"/data/fetchids\", 0o700)\n    system.drop_privs_to('fetchmail')\n    config = system.set_env()\n    while True:\n        delay = int(os.environ.get('FETCHMAIL_DELAY', 60))\n        print(\"Sleeping for {} seconds\".format(delay))\n        time.sleep(delay)\n\n        if not config.get('FETCHMAIL_ENABLED', True):\n            print(\"Fetchmail disabled, skipping...\")\n            continue\n\n        run(config.get('DEBUG', False))\n        sys.stdout.flush()\n", "path": "optional/fetchmail/fetchmail.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\nimport time\nimport os\nfrom pathlib import Path\nfrom pwd import getpwnam\nimport tempfile\nimport shlex\nimport subprocess\nimport requests\nfrom socrate import system\nimport sys\nimport traceback\n\n\nFETCHMAIL = \"\"\"\nfetchmail -N \\\n    --idfile /data/fetchids --uidl \\\n    --pidfile /dev/shm/fetchmail.pid \\\n    --sslcertck --sslcertpath /etc/ssl/certs \\\n    -f {}\n\"\"\"\n\n\nRC_LINE = \"\"\"\npoll \"{host}\" proto {protocol}  port {port}\n    user \"{username}\" password \"{password}\"\n    is \"{user_email}\"\n    smtphost \"{smtphost}\"\n    {folders}\n    {options}\n    {lmtp}\n\"\"\"\n\n\ndef escape_rc_string(arg):\n    return \"\".join(\"\\\\x%2x\" % ord(char) for char in arg)\n\n\ndef fetchmail(fetchmailrc):\n    with tempfile.NamedTemporaryFile() as handler:\n        handler.write(fetchmailrc.encode(\"utf8\"))\n        handler.flush()\n        command = FETCHMAIL.format(shlex.quote(handler.name))\n        output = subprocess.check_output(command, shell=True)\n        return output\n\n\ndef run(debug):\n    try:\n        fetches = requests.get(f\"http://{os.environ['ADMIN_ADDRESS']}:8080/internal/fetch\").json()\n        for fetch in fetches:\n            fetchmailrc = \"\"\n            options = \"options antispam 501, 504, 550, 553, 554\"\n            options += \" ssl\" if fetch[\"tls\"] else \"\"\n            options += \" keep\" if fetch[\"keep\"] else \" fetchall\"\n            folders = \"folders %s\" % ((','.join('\"' + item + '\"' for item in fetch['folders'])) if fetch['folders'] else '\"INBOX\"')\n            fetchmailrc += RC_LINE.format(\n                user_email=escape_rc_string(fetch[\"user_email\"]),\n                protocol=fetch[\"protocol\"],\n                host=escape_rc_string(fetch[\"host\"]),\n                port=fetch[\"port\"],\n                smtphost=f'{os.environ[\"FRONT_ADDRESS\"]}' if fetch['scan'] else f'{os.environ[\"FRONT_ADDRESS\"]}/2525',\n                username=escape_rc_string(fetch[\"username\"]),\n                password=escape_rc_string(fetch[\"password\"]),\n                options=options,\n                folders='' if fetch['protocol'] == 'pop3' else folders,\n                lmtp='' if fetch['scan'] else 'lmtp',\n            )\n            if debug:\n                print(fetchmailrc)\n            try:\n                print(fetchmail(fetchmailrc))\n                error_message = \"\"\n            except subprocess.CalledProcessError as error:\n                error_message = error.output.decode(\"utf8\")\n                # No mail is not an error\n                if not error_message.startswith(\"fetchmail: No mail\"):\n                    print(error_message)\n                user_info = \"for %s at %s\" % (fetch[\"user_email\"], fetch[\"host\"])\n                # Number of messages seen is not a error as well\n                if (\"messages\" in error_message and\n                        \"(seen \" in error_message and\n                        user_info in error_message):\n                    print(error_message)\n            finally:\n                requests.post(\"http://{}:8080/internal/fetch/{}\".format(os.environ['ADMIN_ADDRESS'],fetch['id']),\n                    json=error_message.split('\\n')[0]\n                )\n    except Exception:\n        traceback.print_exc()\n\n\nif __name__ == \"__main__\":\n    id_fetchmail = getpwnam('fetchmail')\n    Path('/data/fetchids').touch()\n    os.chown(\"/data/fetchids\", id_fetchmail.pw_uid, id_fetchmail.pw_gid)\n    os.chown(\"/data/\", id_fetchmail.pw_uid, id_fetchmail.pw_gid)\n    os.chmod(\"/data/fetchids\", 0o700)\n    system.drop_privs_to('fetchmail')\n    config = system.set_env()\n    while True:\n        delay = int(os.environ.get('FETCHMAIL_DELAY', 60))\n        print(\"Sleeping for {} seconds\".format(delay))\n        time.sleep(delay)\n\n        if not config.get('FETCHMAIL_ENABLED', True):\n            print(\"Fetchmail disabled, skipping...\")\n            continue\n\n        run(config.get('DEBUG', False))\n        sys.stdout.flush()\n", "path": "optional/fetchmail/fetchmail.py"}]}