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

qmail migration: handle forwared mails better #555

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions source/migration/qmail/reports/config-is-catchall.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and mailboxes etc. But it depends very much on how you use these catchall and ot
Workaround to keep "-" delimiter catchall
-----------------------------------------

Assuming that you have a ``.qmail-shops-default`` that you want to migrate.
Assuming that you have a ``.qmail-shop-default``, ``.qmail-shops-default`` ,``.qmail-newsletter-default`` ,``.qmail-newsletters-default`` that you want to migrate.

First you will need to setup a general catchall, therefore you create for example a mailbox named ``catchall-mailbox``:

Expand All @@ -36,17 +36,16 @@ Then you configure the catchall to forward mails to this mailbox:
[isabell@stardust ~]$ uberspace mail catchall set catchall-mailbox
Mails, which cannot be matched to a mailbox, will be sent to catchall-mailbox.

Then on the mailbox ``catchall-mailbox`` you need to configure with Sieve filters, that all mails **except** mails to
``shops-*@`` will be rejected:
Then on the mailbox ``catchall-mailbox`` you need to configure with Sieve filters, that all mails **except** mails to matching the correct Delivered-To Header will be rejected ( Using the ``Delivered-To:`` Header ensures forwarded mails are handled correctly ):

.. code-block::

require ["fileinto", "reject"];
if address :matches "to" "shops-*@*" {
keep;
} else {
reject;
}
require ["fileinto", "reject", "regex"];
if header :regex "Delivered-To" "^[^-]+-(shops?-.+|newsletters?-.+)@.+" {
keep;
} else {
reject "";
}

This example script will keep the mails in the new mailbox, but you can also use ``fileinto`` to store them in specific
folders or forward them to another mailaddress with ``redirect``.