[GH-ISSUE #332] Documentation about tags #220

Closed
opened 2026-03-15 13:17:57 +03:00 by kerem · 7 comments
Owner

Originally created by @blackshot on GitHub (Jul 9, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/332

I'm currently trying to implement mailpit as a developer centralized mail sandbox for all my mails, in order to effectively do that i need to implement automatic tags, i made a yaml file as documentation says, it loads the tags but none of the emails are being tagged.

i couldn't find any documentation of how to build a matcher. even i tried to find it in source code but couldn't find anything.

EDIT: I somehow made it work using matcher "addressed:..." but "from:..." is not working.

Originally created by @blackshot on GitHub (Jul 9, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/332 I'm currently trying to implement mailpit as a developer centralized mail sandbox for all my mails, in order to effectively do that i need to implement automatic tags, i made a yaml file as documentation says, it loads the tags but none of the emails are being tagged. i couldn't find any documentation of how to build a matcher. even i tried to find it in source code but couldn't find anything. EDIT: I somehow made it work using matcher "addressed:..." but "from:..." is not working.
kerem closed this issue 2026-03-15 13:18:03 +03:00
Author
Owner

@axllent commented on GitHub (Jul 9, 2024):

Hi @blackshot.

I cannot really make any comment without seeing the exact filter syntax you are using.

The following types of filter rules should work (you'll see both uses of addressed: and from: which work as expected for me):

filters:
  - match: addressed:accounts@example.com
    tags: Accounts
  - match: from:notifications@github.com
    tags: Github
  - match: from:@github.com subject:axllent/mailpit
    tags: Github, Mailpit

This is documented here. The match is exactly the same as you would use in the web UI to search/filter messages, which is documented here.

Edit: I wonder if it had to do with the quotes that were in the documentation (it had quotes around the match variables) ... it works perfectly fine for me without quotes (which I have now removed from the documentation).

<!-- gh-comment-id:2218853289 --> @axllent commented on GitHub (Jul 9, 2024): Hi @blackshot. I cannot really make any comment without seeing the exact filter syntax you are using. The following types of filter rules should work (you'll see both uses of `addressed:` and `from:` which work as expected for me): ```yaml filters: - match: addressed:accounts@example.com tags: Accounts - match: from:notifications@github.com tags: Github - match: from:@github.com subject:axllent/mailpit tags: Github, Mailpit ``` This is [documented here](https://mailpit.axllent.org/docs/usage/tagging/#set-filters-using---tag). The match is exactly the same as you would use in the web UI to search/filter messages, which is [documented here](https://mailpit.axllent.org/docs/usage/search-filters/). Edit: I wonder if it had to do with the quotes that were in the documentation (it had quotes around the `match` variables) ... it works perfectly fine for me without quotes (which I have now removed from the documentation).
Author
Owner

@blackshot commented on GitHub (Jul 9, 2024):

i just copied and pasted the documentation then removed the subject and addressed examples and left only the "from" example and changed the mail. didn't work, obviously i checked yaml syntax and enabled --verbose to check if it was loaded. it was.

could it be that "from" is in format "Name Surname" <example@domain.tld> ?

<!-- gh-comment-id:2218983882 --> @blackshot commented on GitHub (Jul 9, 2024): i just copied and pasted the documentation then removed the subject and addressed examples and left only the "from" example and changed the mail. didn't work, obviously i checked yaml syntax and enabled --verbose to check if it was loaded. it was. could it be that "from" is in format `"Name Surname" <example@domain.tld>` ?
Author
Owner

@axllent commented on GitHub (Jul 10, 2024):

Yes, that could be it. Please try your search first in the web UI to make sure it works we you would expect. I think in your case you probably want from:example@domain.tld.

<!-- gh-comment-id:2219514430 --> @axllent commented on GitHub (Jul 10, 2024): Yes, that could be it. Please try your search first in the web UI to make sure it works we you would expect. I think in your case you probably want `from:example@domain.tld`.
Author
Owner

@blackshot commented on GitHub (Jul 17, 2024):

Yes, that could be it. Please try your search first in the web UI to make sure it works we you would expect. I think in your case you probably want from:example@domain.tld.

did exactly that and didn't work haha, i opted just to use "addressed:example@domain.tld" and controlling it by recipient which is working.

<!-- gh-comment-id:2233704892 --> @blackshot commented on GitHub (Jul 17, 2024): > Yes, that could be it. Please try your search first in the web UI to make sure it works we you would expect. I think in your case you probably want `from:example@domain.tld`. did exactly that and didn't work haha, i opted just to use "addressed:example@domain.tld" and controlling it by recipient which is working.
Author
Owner

@axllent commented on GitHub (Jul 17, 2024):

Sorry, then I'm totally out of ideas as it's just guesswork here because I don't know the exact syntax you originally used in your yaml config, nor exactly what your email headers say. I realise the sensitivity of the information though (not to put it on GitHub etc).

Given that you have a working solution using addressed:, I'm going to close this issue as it doesn't look like something that can be solved unless I have all that information,. As I also mentioned earlier, I use from: and it is working for me, so I don't believe it is a bug either 👍

<!-- gh-comment-id:2234064857 --> @axllent commented on GitHub (Jul 17, 2024): Sorry, then I'm totally out of ideas as it's just guesswork here because I don't know the exact syntax you originally used in your yaml config, nor exactly what your email headers say. I realise the sensitivity of the information though (not to put it on GitHub etc). Given that you have a working solution using `addressed:`, I'm going to close this issue as it doesn't look like something that can be solved unless I have all that information,. As I also mentioned earlier, I use `from:` and it is working for me, so I don't believe it is a bug either 👍
Author
Owner

@bthall commented on GitHub (Aug 16, 2024):

Commenting in hopes that it will help others.

I encountered a similar issue in which none of my filters would work on a docker instance. I had previously set up this container and tried to add the MP_TAGS_CONFIG environment variable and configuration file afterward. Even after running a docker compose down and docker compose up, the tag filters were not loaded even though I verified the files were available within the container.

I had to docker compose down and then docker image rm axllent/mailpit before executing docker compose up again. It seems like the tags configuration MP_TAGS_CONFIG is only loaded on the first run of the container. With that said, I probably would have been fine by just running docker compose down and docker compose up --build --force-recreate.

<!-- gh-comment-id:2292538025 --> @bthall commented on GitHub (Aug 16, 2024): Commenting in hopes that it will help others. I encountered a similar issue in which none of my filters would work on a docker instance. I had previously set up this container and tried to add the `MP_TAGS_CONFIG` environment variable and configuration file afterward. Even after running a `docker compose down` and `docker compose up`, the tag filters were not loaded even though I verified the files were available within the container. I had to `docker compose down` and then `docker image rm axllent/mailpit` before executing `docker compose up` again. It seems like the tags configuration `MP_TAGS_CONFIG` is only loaded on the first run of the container. With that said, I probably would have been fine by just running `docker compose down` and `docker compose up --build --force-recreate`.
Author
Owner

@axllent commented on GitHub (Aug 16, 2024):

That is strange @bthall, and definitely not a limitation within Mailpit. Each time Mailpit restarts it will load whatever environment settings (or flags) are passed to it, and there should be no need to delete the docker image at all.

What may however be happening here is that when you docker compose up with an existing container it just starts the container with previously set variables? I'm not 100% sure though as I'm not a big user of docker compose (I use docker a lot though, but always delete the old container when redeploying). If this is the case then I do not think this is normal Docker (compose) behaviour either, unless you were using restart instead of down and then up.

The easy way to test is to log into your running docker container, assuming it's name is "mailpit": docker exec -it mailpit sh and then type env which will print out the current environment variables.

<!-- gh-comment-id:2292658848 --> @axllent commented on GitHub (Aug 16, 2024): That is strange @bthall, and definitely not a limitation within Mailpit. Each time Mailpit restarts it will load whatever environment settings (or flags) are passed to it, and there should be no need to delete the docker image at all. What may however be happening here is that when you `docker compose up` with an existing container it just starts the container with previously set variables? I'm not 100% sure though as I'm not a big user of `docker compose` (I use docker a lot though, but always delete the old container when redeploying). If this is the case then I do not think this is normal Docker (compose) behaviour either, unless you were using `restart` instead of `down` and then `up`. The easy way to test is to log into your running docker container, assuming it's name is "mailpit": `docker exec -it mailpit sh` and then type `env` which will print out the current environment variables.
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#220
No description provided.