mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 00:35:51 +03:00
[GH-ISSUE #69] Support for dynamic tags #45
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ocean90 on GitHub (Mar 21, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/69
The tagging systems is really great! But currently it's a bit static as that you have to define the tags in advance.
My use case: Have a single Docker container for Mailpit and allow other (which are unknown before starting Mailpit) Docker containers via Traefik to use this Mailpit container to capture all emails. Now I'd like to have a tag which contains the source of the mail which is usually the host of the sender address. I'm calling this dynamic tags which could be defined with a regular expression like this:
$1would contain the matched group.Does this make sense? Are tags the right thing for this since it seems like they apply to the whole message and not only a specific header?
@axllent commented on GitHub (Mar 21, 2023):
@ocean90 You are right, the tagging system is very "static" and quite limited, but this is somewhat intentional. Basically Mailpit was not originally designed with tagging in mind, not that it really changes the limitations. The automated tagging is done on a full body string match, and not limited to just the headers, nor does it support regular expressions. The thing is it won't / can't support regular expressions as one completely loses control of a) bad regex, and b) the matches - the result being that unsupported characters and potentially very long strings would get applied as tags and effectively break the UI. By pre-defining the tags Mailpit can at least validate the tag names at runtime, and display an error if invalid.
So the short answer is this isn't possible. The only solution I can think of is you finding a common string from each host (eg: an IP address of the host machine) and pre-defining your tags that way, for example
--tag 'host1=1.2.3.4 host2=2.3.4.5'. Obviously those IP addresses would need to be in the message headers somewhere. Sorry, it's probably not the solution you were after, but it's the only solution I can think of. Does this make sense?@ocean90 commented on GitHub (Mar 22, 2023):
Thanks for the response! Definitely makes sense but I can't use it since the other containers are totally dynamic.
I guess what I'm really looking for is some sort of different inboxes based on the sender. I'm going to close this for now since it was just a nice-to-have but not important feature request.