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 :v:

For more info:

8 Likes

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.

7 Likes

If you go to a grocery shop to buy vegetables and they only accept cash, is the shop owner hostile towards those who want to use a credit card? :stuck_out_tongue:

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.

4 Likes

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
1 Like

I know it is an off-base analogy (hence the tongue emoji in the end), but it serves the purpose to demonstrate one thing: it’s up to businesses to decide what’s the best way to provide their goods/service, and up to customers/users to decide whether or not to accept those terms.

I disagree with your generalisation that companies need your email only to spam you, and that it is a “mildly dark pattern” (whatever that means in this context), but I will stop here since this is not the topic of the thread.

I was indeed worried about performance, but I’m not actually using files — all domains are inlined and compiled with the module. Could you maybe open a PR with a proof-of-concept?

all domains are inlined and compiled with the module

What do you mean? Didn’t see that in code … You make a list lookup.

Could you maybe open a PR with a proof-of-concept?

Maybe later.

https://github.com/heresydev/email_guard/pull/1

1 Like

Published 1.1.0 with significant performance improvements, thanks to @idi527 :tada:

See CHANGELOG.md for more info.

1 Like