[GH-ISSUE #375] Recipient allowlist on smtpd #246

Closed
opened 2026-03-15 13:24:47 +03:00 by kerem · 3 comments
Owner

Originally created by @sorcix on GitHub (Oct 17, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/375

I'm using Mailpit as a simple single-user temporary e-mail server. While I understand it's not meant to be used like this, it actually works really great. The only downside, for my use case, is that it accepts every random message sent to port 25.

Would you accept a PR that adds an additional flag --smtp-allow-recipients that takes a regex and rejects/drops e-mails where the recipient doesn't match? Could be used with something like @(temp.example.com|foo.com)$.

Originally created by @sorcix on GitHub (Oct 17, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/375 I'm using Mailpit as a simple single-user temporary e-mail server. While I understand it's not meant to be used like this, it actually works really great. The only downside, for my use case, is that it accepts every random message sent to port 25. Would you accept a PR that adds an additional flag `--smtp-allow-recipients` that takes a regex and rejects/drops e-mails where the recipient doesn't match? Could be used with something like `@(temp.example.com|foo.com)$`.
kerem closed this issue 2026-03-15 13:24:53 +03:00
Author
Owner

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

I'm pretty sure this already exists.

From the docs: --smtp-allowed-recipients: Only allow SMTP recipients matching a regular expression. Use this to restrict incoming mail to only those sent to a pre-defined list. An example would be --smtp-allowed-recipients '@example.com$' to only allow emails sent to recipients ending in @example.com.

<!-- gh-comment-id:2420190152 --> @axllent commented on GitHub (Oct 17, 2024): I'm pretty sure this already exists. From the docs: `--smtp-allowed-recipients`: Only allow SMTP recipients matching a regular expression. Use this to restrict incoming mail to only those sent to a pre-defined list. An example would be `--smtp-allowed-recipients '@example.com$'` to only allow emails sent to recipients ending in `@example.com`.
Author
Owner

@sorcix commented on GitHub (Oct 17, 2024):

D'oh. I managed to overlook an option that's named almost the same as what I proposed. That's what I was looking for, thanks.

<!-- gh-comment-id:2420331909 --> @sorcix commented on GitHub (Oct 17, 2024): D'oh. I managed to overlook an option that's named almost the same as what I proposed. That's what I was looking for, thanks.
Author
Owner

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

All good ;-) There's a lot of options unfortunately, so sometimes easy to overlook stuff.

<!-- gh-comment-id:2420349571 --> @axllent commented on GitHub (Oct 17, 2024): All good ;-) There's a lot of options unfortunately, so sometimes easy to overlook stuff.
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#246
No description provided.