diff --git a/docs/debug-common_problems.md b/docs/debug-common_problems.md index 8f8d1cafc..66d79ef86 100644 --- a/docs/debug-common_problems.md +++ b/docs/debug-common_problems.md @@ -52,3 +52,20 @@ ERROR: for postfix-mailcow Cannot start service postfix-mailcow: driver failed ``` while trying to start / install mailcow: dockerized, make sure you've followed our section on the [prerequisites](prerequesite-system/#firewall-ports). + +## XYZ can't connect to ... + +Please check your local firewall! + +If you experience connection problems from home, please check your ISP router's firewall too, some of them block mail traffic on the *SMTP* (587) or *SMTPS* (465) ports. It could also be, that your ISP is blocking the ports for *SUBMISSION* (25). + +While Linux users can chose from a variety of tools[^1] to check if a port is open, the Windows user has only the command `telnet host port` available by default (and it has to be activated since Windows Vista). + +To enable telnet on a Windows after Vista please check this [guide](https://social.technet.microsoft.com/wiki/contents/articles/910.windows-7-enabling-telnet-client.aspx) or enter the following command in an terminal **with administrator priviliges**: + +``` +dism /online /Enable-Feature /FeatureName:TelnetClient +``` + + +[^1]: [netcat](https://linux.die.net/man/1/nc), [nmap](https://linux.die.net/man/1/nmap), [openssl](https://wiki.openssl.org/index.php/Manual:S_client(1)), [telnet](https://linux.die.net/man/1/telnet), etc. diff --git a/docs/u_e-dovecot-expunge.md b/docs/u_e-dovecot-expunge.md new file mode 100644 index 000000000..19cd21a14 --- /dev/null +++ b/docs/u_e-dovecot-expunge.md @@ -0,0 +1,44 @@ +If you want to delete old mails out of the `.Junk` or `.Trash` folders or maybe delete all read mails that are older than a certain amount of time you may use dovecot's tool doveadm [man doveadm-expunge](https://wiki.dovecot.org/Tools/Doveadm/Expunge). + +## The manual way + +That said, let's dive in: + +Delete a user's mails inside the junk folder that **are read** and **older** than 4 hours + +``` +docker-compose exec dovecot-mailcow doveadm expunge -u 'mailbox@example.com' mailbox 'Junk' SEEN not SINCE 4h +``` + +Delete **all** user's mails in the junk folder that are **older** than 7 days + +``` +docker-compose exec dovecot-mailcow doveadm expunge -A mailbox 'Junk' savedbefore 7d +``` + +Delete mails inside a custom folder **inside** a user's inbox that are **not** flagged and **older** than 2 weeks + +``` +docker-compose exec dovecot-mailcow doveadm expunge -u 'mailbox@example.com' mailbox 'INBOX/custom-folder' not FLAGGED not SINCE 2w +``` + +!!! info + For possible [time spans](https://wiki.dovecot.org/Tools/Doveadm/SearchQuery#section_date_specification) or [search keys](https://wiki.dovecot.org/Tools/Doveadm/SearchQuery#section_search_keys) have a look at [man doveadm-search-query](https://wiki.dovecot.org/Tools/Doveadm/SearchQuery) + +## Make it automatic + +If you want to automate such a task you can create a cron job on your host that calls a script like the one below: + +``` +#!/bin/bash +/usr/local/bin/docker-compose exec -T doveadm dovecot-mailcow doveadm expunge -A mailbox 'Junk' savedbefore 2w +/usr/local/bin/docker-compose exec -T doveadm expunge -A mailbox 'Junk' SEEN not SINCE 12h +[...] +``` + +To create a cron job you may execute `crontab -e` and insert something like the following to execute a script: + +``` +# Execute everyday at 04:00 A.M. +0 4 * * * /path/to/your/expunge_mailboxes.sh +``` diff --git a/docs/u_e-dovecot-more.md b/docs/u_e-dovecot-more.md new file mode 100644 index 000000000..09d0856ac --- /dev/null +++ b/docs/u_e-dovecot-more.md @@ -0,0 +1,48 @@ +Here is just an unsorted list of useful `doveadm` commands that could be useful. + +## doveadm quota + +The `quota get` and `quota recalc`[^1] commands are used to display or recalculate the current user's quota usage. The reported values are in *kilobytes*. + +To list the current quota status for a user / mailbox, do: + +``` +doveadm quota get -u 'mailbox@example.org' +``` + +To list the quota storage value for **all** users, do: + +``` +doveadm quota get -A |grep "STORAGE" +``` + +Recalculate a single user's quota usage: + +``` +doveadm quota recalc -u 'mailbox@example.org' +``` + +## doveadm search + +The `doveadm search`[^2] command is used to find messages matching your query. It can return the username, mailbox-GUID / -UID and message-GUIDs / -UIDs. + +To view the number of messages, by user, in their **.Trash** folder: + +``` +doveadm search -A mailbox 'Trash' | awk '{print $1}' | sort | uniq -c +``` + +Show all messages in a user's **inbox** older then 90 days: + +``` +doveadm search -u 'mailbox@example.org' mailbox 'INBOX' savedbefore 90d +``` + +Show **all messages** in **any folder** that are **older** then 30 days for `mailbox@example.org`: + +``` +doveadm search -u 'mailbox@example.org' mailbox "*" savedbefore 30d +``` + +[^1]:https://wiki.dovecot.org/Tools/Doveadm/Quota +[^2]:https://wiki.dovecot.org/Tools/Doveadm/Search diff --git a/mkdocs.yml b/mkdocs.yml index be973b7c8..6c327d105 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,11 +43,14 @@ pages: - 'Temporary email aliase': 'u_e-mailcow_ui-spamalias.md' - 'Tagging': 'u_e-mailcow_ui-tagging.md' - 'Two-Factor Authentication': 'u_e-mailcow_ui-tfa.md' - - 'Redis': 'u_e-redis.md' - - 'Rspamd': 'u_e-rspamd.md' - 'Postfix': - 'Anonymize Headers': 'u_e-postfix-anonym_headers.md' - 'Disable Sender Addresses Verification': 'u_e-postfix-disable_sender_verification.md' + - 'Dovecot': + - "Expunge a User's Mails": 'u_e-dovecot-expunge.md' + - 'More Examples with DOVEADM': 'u_e-dovecot-more.md' + - 'Redis': 'u_e-redis.md' + - 'Rspamd': 'u_e-rspamd.md' - 'Docker': - 'Customize Dockerfiles': 'u_e-docker-cust_dockerfiles.md' - 'Docker Compose Bash Completion': 'u_e-docker-dc_bash_compl.md'