[GH-ISSUE #410] Tagging filters with regex support #266

Closed
opened 2026-03-15 13:32:40 +03:00 by kerem · 2 comments
Owner

Originally created by @stefankluempers on GitHub (Dec 14, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/410

We use a central Mailpit instance to support various projects. Each project uses a project-specific mail domain.
It would be very helpful if automatic tagging based on the mail domain could be configured. Can the filter definition be extended to include regex support with matching groups for tag definition?

To use the local part or mail domain for tag definition, the configuration could be as follows, for example:
filters:

  - match: addressed:(.*)@example.com
    tags: Tag $1
  - match: from:from@(.*).com
    tags: Tag $1, $1
Originally created by @stefankluempers on GitHub (Dec 14, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/410 We use a central Mailpit instance to support various projects. Each project uses a project-specific mail domain. It would be very helpful if automatic tagging based on the mail domain could be configured. Can the filter definition be extended to include regex support with matching groups for tag definition? To use the local part or mail domain for tag definition, the configuration could be as follows, for example: filters: ``` - match: addressed:(.*)@example.com tags: Tag $1 - match: from:from@(.*).com tags: Tag $1, $1 ```
kerem closed this issue 2026-03-15 13:32:45 +03:00
Author
Owner

@axllent commented on GitHub (Dec 14, 2024):

Hi @stefankluempers. No, unfortunately this is not possible. The tag matches are ultimately mapped to internal SQL queries, so regex is not supported.

As a suggestion, you could configure your projects to add an X-Tags header to the emails they send.

<!-- gh-comment-id:2542627727 --> @axllent commented on GitHub (Dec 14, 2024): Hi @stefankluempers. No, unfortunately this is not possible. The tag matches are ultimately mapped to internal SQL queries, so regex is not supported. As a suggestion, you could configure your projects to add an [X-Tags header](https://mailpit.axllent.org/docs/usage/tagging/#x-tags-header) to the emails they send.
Author
Owner

@stefankluempers commented on GitHub (Dec 14, 2024):

Hi Ralph, thanks for your quick response. X-Tags headers seam to be a good alternative to my suggestion.

<!-- gh-comment-id:2543181822 --> @stefankluempers commented on GitHub (Dec 14, 2024): Hi Ralph, thanks for your quick response. X-Tags headers seam to be a good alternative to my suggestion.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#266
No description provided.