fgribreau / mailchecker
Temporary (disposable/throwaway) email detection library. Covers 1987 fake email providers.
Fund package maintenance!
fgribreau
Installs: 498 546
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1 644
Watchers: 36
Forks: 258
Open Issues: 3
Requires
- php: >=7.3
Requires (Dev)
- phpunit/phpunit: ^10
- dev-master
- v6.0.14
- v6.0.13
- v6.0.12
- v6.0.11
- v6.0.10
- v6.0.9
- v6.0.8
- v6.0.7
- v6.0.6
- v6.0.5
- v6.0.4
- v6.0.3
- v6.0.2
- v6.0.1
- v5.0.9
- v5.0.8
- v5.0.7
- v5.0.6
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.1.19
- v4.1.18
- v4.1.17
- v4.1.16
- v4.1.15
- v4.1.14
- v4.1.13
- v4.1.12
- v4.1.11
- v4.1.10
- v4.1.9
- v4.1.8
- v4.1.7
- v4.1.6
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.16
- v4.0.15
- v4.0.14
- v4.0.13
- v4.0.12
- v4.0.11
- v4.0.10
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.3.17
- v3.3.16
- v3.3.15
- v3.3.14
- v3.3.13
- v3.3.12
- v3.3.11
- v3.3.10
- v3.3.9
- v3.3.8
- v3.3.7
- v3.3.6
- v3.3.5
- v3.3.4
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.39
- v3.2.38
- v3.2.37
- v3.2.36
- v3.2.35
- v3.2.34
- v3.2.33
- v3.2.32
- v3.2.31
- v3.2.30
- v3.2.29
- v3.2.28
- v3.2.27
- v3.2.26
- v3.2.25
- v3.2.24
- v3.2.23
- v3.2.22
- v3.2.21
- v3.2.20
- v3.2.19
- v3.2.18
- v3.2.17
- v3.2.16
- v3.2.15
- v3.2.14
- v3.2.13
- v3.2.12
- v3.2.11
- v3.2.10
- v3.2.9
- v3.2.8
- v3.2.7
- v3.2.6
- v3.2.5
- v3.2.4
- v3.2.3
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.40
- v3.0.39
- v3.0.38
- v3.0.37
- v3.0.36
- v3.0.35
- v3.0.34
- v3.0.33
- v3.0.32
- v3.0.31
- v3.0.30
- v3.0.29
- v3.0.28
- v3.0.27
- v3.0.26
- v3.0.25
- v3.0.24
- v3.0.23
- v3.0.22
- v3.0.21
- v3.0.20
- v3.0.19
- v3.0.18
- v3.0.17
- v3.0.16
- v3.0.15
- v3.0.14
- v3.0.13
- v3.0.12
- v3.0.11
- v3.0.10
- v3.0.9
- v3.0.8
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.1
- v2.0.0
- v1.6.3
- v1.6.2
- dev-fix-circle-ci
- dev-revert-162-master
- dev-greenkeeper/mocha-5.0.1
- dev-greenkeeper/mocha-5.0.0
This package is auto-updated.
Last update: 2024-12-15 13:29:18 UTC
README
Cross-language email validation. Backed by a database of over 55 000 throwable email domains.
- Validate the format of your email (uses validator.js email regex underneath and
FILTER_VALIDATE_EMAIL
for PHP) - Validate if the email is not a temporary mail (yopmail-like..., add your own dataset to list.txt)
This will be very helpful when you have to contact your users and you want to avoid errors causing lack of communication or want to block "spamboxes".
Need to provide Webhooks inside your SaaS?
Need to embed a charts into an email?
It's over with Image-Charts, no more server-side rendering pain, 1 url = 1 chart.
https://image-charts.com/chart?
cht=lc // chart type
&chd=s:cEAELFJHHHKUju9uuXUc // chart data
&chxt=x,y // axis
&chxl=0:|0|1|2|3|4|5| // axis labels
&chs=873x200 // size
Upgrade
From 3.x to 4.x
- PHP
# import using the fully qualified name. use Fgribreau\MailChecker; // ... echo MailChecker::isValid('myemail@yopmail.com');
From 1.x to 3.x
Mailchecker public API has been normalized, here are the changes:
- NodeJS/JavaScript:
MailChecker(email)
->MailChecker.isValid(email)
- PHP:
MailChecker($email)
->MailChecker::isValid($email)
- Python
import MailChecker m = MailChecker.MailChecker() if not m.is_valid('bla@example.com'): # ...
became:
import MailChecker if not MailChecker.is_valid('bla@example.com'): # ...
MailChecker currently supports:
- NodeJS (CommonJS, Instructions)
- JavaScript (Client-Side, Instructions)
- PHP (Instructions)
- Python (Instructions)
- Ruby (Instructions)
- Rust (Instructions)
- Elixir (Instructions)
- Clojure (Instructions)
- Go (Instructions)
- Easily add support for your own language with MailChecker template system and send us a pull-request!
Usage
NodeJS
var MailChecker = require('mailchecker'); if(!MailChecker.isValid('myemail@yopmail.com')){ console.error('O RLY !'); process.exit(1); } if(!MailChecker.isValid('myemail.com')){ console.error('O RLY !'); process.exit(1); }
JavaScript
<script type="text/javascript" src="MailChecker/platform/javascript/MailChecker.js"></script> <script type="text/javascript"> if(!MailChecker.isValid('myemail@yopmail.com')){ console.error('O RLY !'); } if(!MailChecker.isValid('myemail.com')){ console.error('O RLY !'); } </script>
PHP
use Fgribreau\MailChecker; require __DIR__ . '/vendor/autoload.php'; if(!MailChecker::isValid('myemail@yopmail.com')){ die('O RLY !'); } if(!MailChecker::isValid('myemail.com')){ die('O RLY !'); }
Python
pip install mailchecker
# no package yet; just drop in MailChecker.py where you want to use it. from MailChecker import MailChecker if not MailChecker.is_valid('bla@example.com'): print "O RLY !"
Django validator: https://github.com/jonashaag/django-indisposable
Ruby
require 'mail_checker' unless MailChecker.valid?('myemail@yopmail.com') fail('O RLY!') end
Rust
extern crate mailchecker; assert_eq!(true, mailchecker::is_valid("plop@plop.com")); assert_eq!(false, mailchecker::is_valid("\nok@gmail.com\n")); assert_eq!(false, mailchecker::is_valid("ok@guerrillamailblock.com"));
Elixir
Code.require_file("mail_checker.ex", "mailchecker/platform/elixir/") unless MailChecker.valid?("myemail@yopmail.com") do raise "O RLY !" end unless MailChecker.valid?("myemail.com") do raise "O RLY !" end
Clojure
; no package yet; just drop in mailchecker.clj where you want to use it. (load-file "platform/clojure/mailchecker.clj") (if (not (mailchecker/valid? "myemail@yopmail.com")) (throw (Throwable. "O RLY!"))) (if (not (mailchecker/valid? "myemail.com")) (throw (Throwable. "O RLY!")))
Go
package main import ( "log" "github.com/FGRibreau/mailchecker/platform/go" ) if !mail_checker.IsValid('myemail@yopmail.com') { log.Fatal('O RLY !'); } if !mail_checker.IsValid('myemail.com') { log.Fatal("O RLY !") }
Installation
Go
go get https://github.com/FGRibreau/mailchecker
NodeJS/JavaScript
npm install mailchecker
Ruby
gem install ruby-mailchecker
PHP
composer require fgribreau/mailchecker
We accept pull-requests for other package manager.
Data sources
$('td', 'table:last').map(function(){ return this.innerText; }).toArray();
Array.prototype.slice.call(document.querySelectorAll('.entry > ul > li a')).map(function(el){return el.innerText});
... please add your own dataset to list.txt.
Regenerate libraries from list.txt
Just run (requires NodeJS):
npm run build
Development
Development environment requires docker.
# install and setup every language dependencies in parallel through docker npm install # run every language setup in parallel through docker npm run setup # run every language tests in parallel through docker npm test
Backers
Maintainers
These amazing people are maintaining this project:
Sponsors
No sponsors yet! Will you be the first?
Contributors
These amazing people have contributed code to this project:
- Owen Stephens
- Jacob Burenstam Linder
- Herman Slatman
- trisix — view contributions
- Greenkeeper
- Dustin Clark
- Anton Zhiyanov
- Bruel Nicolas — view contributions
- Robin — view contributions
- Spir — view contributions
- Vincent Giersch
- Adrian Carolli
- Dave Powers
- Frank Phillips — view contributions
- LuckyDino — view contributions
- ven — view contributions
- Romain Gay
- Sebastian Cohnen
- Dalai — view contributions
- quaswex — view contributions
- sxyuan — view contributions
- Francois-Guillaume Ribreau
- Dusty
- larsvegas
- Zeeshan Muhammad
- kkleejoe — view contributions
- Luiz Freneda
- thorinisme — view contributions
- Liudas Šumskas — view contributions
- Alexander — view contributions
- Alex Domakidis
- Carlos Rios
- Jacek Bzdak — view contributions
- D — view contributions
- Jonas Haag
- Alex Domakidis
- Dan McGregor — view contributions
- Thiago Rodrigues
- Dilli Labs LLC
- Kieron Lawson
- Kslr
- Lint
- chadliu23 — view contributions
- milkyklim
- Sharat M R — view contributions
- Nicolas Perraud — view contributions
- tbdmainrepo — view contributions
- Kslr — view contributions
- Fabio Caccamo
- cyril souillard — view contributions
- Grégoire Pineau
- Bruno Bossola
- florian-crtl — view contributions
- mikeyzm
- Grégoire Pineau
- alonga — view contributions
- Vitalii Tverdokhlib
- Francis Chuang — view contributions
- mikeyzm — view contributions
- Pascal Vizeli
- Caroline — view contributions
- Daniel Mihai
- HWVS — view contributions
- seb's — view contributions
- Chigusa0w0
- Maki
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
Changelog
License
Unless stated otherwise all works are:
- Copyright © Francois-Guillaume Ribreau
and licensed under: