DisposableEmail
Prevent fake signups and spam: Elixir library for detecting disposable and temporary emails, using an up-to-date blocklist of over 5,000 domains.
Features
-
Handles subdomain matching (e.g.,
user@sub.domain.com) - Fast in-memory lookup using ETS tables
- Supports scheduled downloads of the latest blocklist from github.com/disposable-email-domains
## https://hexdocs.pm/quantum/Quantum.html
config :my_app, MyApp.Scheduler,
jobs: [
{"@daily", {DisposableEmail, :reload, []}},
]If blocklist download fails, an error is logged, but the app continues running using the most recent available blocklist (bundled at startup or last successful download).
Installation
Add disposable_email to your list of dependencies in mix.exs:
def deps do
[
{:disposable_email, "~> 0.5"}
]
endUsage
# Check if an email is from a disposable domain
DisposableEmail.disposable?("user@tempmail.com")
# => true
DisposableEmail.disposable?("user@gmail.com")
# => false