Skip to content

Instantly share code, notes, and snippets.

@nfreear
Created December 6, 2017 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfreear/f8cd25c77b84dc8c047acf99edb4fcf3 to your computer and use it in GitHub Desktop.
Save nfreear/f8cd25c77b84dc8c047acf99edb4fcf3 to your computer and use it in GitHub Desktop.
Burner / disposable email validation test.
<!doctype html> <title> * Burner email test </title>
<style>
body, input, button { color: #222; font: 1.1rem sans-serif; margin: 1em auto; max-width: 40em; }
h1 { font-weight: normal; }
form { background: #fdfdfd; border: 1px solid #ccc; border-radius: 5px; padding: 2px 1em; }
input { x-border-radius: 3px; min-width: 16em; padding: 2px 6px; }
:invalid { border: 1px solid red; }
input:invalid { background: #fee; }
</style>
<h1> Burner email validation test </h1>
<form>
<p><label>Email address
<input name="email" type="email" required value="example@yopmail.com" />
</label>
<p><button type="submit">Submit</button>
</form>
<script src="https://unpkg.com/jquery@3.2.1/dist/jquery.min.js"></script>
<script>
window.jQuery(function ($) {
var $form = $('form');
$form.on('submit', function (ev) {
ev.preventDefault();
var $email = $(ev.target).find('[ name = email ]');
$.getJSON('https://www.deaguard.eu.org/email/' + $email.val())
.done(function (data) {
console.warn('Disposable email?', data);
if (data.disposable) {
$email[ 0 ].setCustomValidity('Disposable / burner email addresses are not accepted.');
$form[ 0 ].reportValidity();
}
});
});
});
</script>
<pre>
© Nick Freear, 06-Dec-2017.
* https://www.deaguard.eu.org/
* https://github.com/nfreear/burner-email-providers
</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment