MailFlatDocs
Documentation/Common test cases/Tags and plus-addressing

Filtering mail with plus-addressing tags

One inbox, many senders: add a plus tag to the address and MailFlat records it as a field you can filter on.

How it works

Anything after a plus in the local part is a tag. Mail to shop+newsletter@a7f2c.mailflat.net lands in the shop inbox with tag set to newsletter. Nothing needs to be configured first, and the tag travels through every client and the webhook payload.

Send to a tagged address

The tag is invented at send time — no setup call.
tagged = inbox.address.replace("@", "+newsletter@")
my_app.subscribe(email=tagged)

Filter by tag

Read every message and keep the ones the tag identifies.
news = [m for m in inbox.messages() if m.tag == "newsletter"]
assert len(news) == 1

Worth knowing

Tags are labels, not inboxes
A tag does not create a new mailbox and does not have its own retention. It is a field on the message, so it is perfect for telling senders apart inside one address and wrong for isolating parallel test runs — use a separate inbox for that.