mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 00:35:51 +03:00
[GH-ISSUE #415] [feature-request] Additional hook on incoming email BEFORE processing #270
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#270
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 @baiomys on GitHub (Dec 31, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/415
Hi, it would be handy to have a possibility of calling a worker to analyze TO, FROM, SIZE (if sent), and make a decision to accept or reject email. This measure can cut about 80% of dumb spam traffic, dramatically reducing VPS load/cost.
@axllent commented on GitHub (Jan 1, 2025):
Hi @baiomys. The SMTP protocol doesn't work in that way - the message needs to be accepted & received before things like the size can be seen. Furthermore, in order to "filter" by
TOandFROMduring delivery, then Mailpit would need to interact with a third party API as part of the SMTP process, which in itself would be prone to errors if, for instance, Mailpit can't contact the the API, or Mailpit receives 1000 messages in a second.Mailpit is designed to accept everything provided it is a valid SMTP transaction, with one exception being the
--smtp-allowed-recipients/MP_SMTP_ALLOWED_RECIPIENTSoption which can be used to limit addresses and domains (using a regular expression, so not complicated, and probably not what you are needing).If Mailpit is exposed to the internet, then you are going to get spam at some point I'm afraid, just like any open SMTP server. If you are wanting to filter received messages to remove spam, then I think you should be doing things very differently, either:
I think that the first option is probably the easiest. It still means the spam message is received in Mailpit, however it is potentially just deleted afterwards by your webhook endpoint / API if it fails the checks.
I am curious as to how receiving 80% more messages is drastically increasing your VPS & load. Is this extra load on the Mailpit side (and if so, how many messages are you handling every hour?), or is this on your bot side?
@baiomys commented on GitHub (Jan 1, 2025):
Hi, thanks for detailed answer.
It is obvious now that I should use workers on Cloudflare side for basic spam filtering.
At least until I get 100 000 messages a day.
In decentralized system, having dozen of pits around the globe and 4 bots it is impossible to touch any messages by core handler just to check validity. Or you need to be META at least. =)
Core handler even does not upload emails by request itself, just validates credentials and redirects browser to corresponding pit that use fancy Caddy templates to get things running.
Planning must be done VERY CAREFULLY, because reengineering of live project is real pain in the ....