svilen
EmailGuard — library for detecting disposable or personal email addresses
EmailGuard is a simple utility library for detecting disposable (burner) or personal email addresses. Comes with two big data sets ready to use:
-
DisposableList(source) containing 3846 domains of temporary email providers and is the default list to use if no params are provided; -
FreeList(source) containing 5072 domains of free email providers (with domains already in disposable data set removed)
Example usage:
iex> EmailGuard.check("svilen@gmail.com")
:ok
iex> EmailGuard.check("svilen@mailinator.com")
{:error, "EmailGuard.DisposableList"}
iex> alias EmailGuard.{DisposableList, FreeList}
iex> EmailGuard.check("svilen@gmail.com", [DisposableList, FreeList])
{:error, "EmailGuard.FreeList"}
Hope it’s useful 
For more info:
Most Liked
gon782
I can’t help but think this is a bit user hostile if action is taken based on it, if it’s not one point in a total risk assessment or something.
gon782
That’s an incredibly off-base analogy. An e-mail address isn’t a payment form and receiving spam from a company that for no reason wants your e-mail isn’t the same as trading money for a product. I’m sorry if I offended anyone who uses this mildly dark pattern and wants to rationalize it, but you’re definitely moving towards user hostility in doing so, unless you can prove value to your users and show that value as an imperative to using a real e-mail address.
idi527
The lookup process seems a bit inefficient, I would pattern match on function heads instead.
for bad_domain <- File.stream!("bad_domains") do
def lookup(unquote(bad_domain)), do: "EmailGuard.BadDomainList"
end
def lookup(_unmatched), do: nil
def check(email) do
domain = extract_domain(email)
if resp = lookup(domain) do
{:error, resp}
else
:ok
end
end
idi527
svilen
Published 1.1.0 with significant performance improvements, thanks to @idi527 
See CHANGELOG.md for more info.







