Reputation: 433
I am developing website using php/codeigniter.
I have downloaded a list of temporary email domains from github (https://gist.github.com/adamloving/4401361)
I integrated this to my website to filter and validate email address.But I noticed that some domains are garbage and cannot detect by the list provided.
Please image below.
Currently Im using this code to filter/validate emails:
public function is_temp_mail($mail='')
{
$this->db->select('domain');
$this->db->from('table_disposal_email_domains');
$domains=$this->db->get()->result();
foreach($domains as $domain)
{
list(,$mail_domain) = explode('@',$mail);
if(strcasecmp($mail_domain, $domain->domain) == 0){
return true;
}
}
return false;
}
How to block garbage domains.Please help.
Upvotes: 5
Views: 4643
Reputation: 1
If you use PHP, you can try this package - beeyev/disposable-email-filter-php
The list of disposable email domains is regularly updated automatically from trusted external sources.
The usage is super simple, here is an example:
<?php
require __DIR__ . '/vendor/autoload.php';
use Beeyev\DisposableEmailFilter\DisposableEmailFilter;
$disposableEmailFilter = new DisposableEmailFilter();
// Check if email address is disposable
$disposableEmailFilter->isDisposableEmailAddress('[email protected]'); // false
$disposableEmailFilter->isDisposableEmailAddress('[email protected]'); // true
Upvotes: 0
Reputation: 41
I wrote a simple API for determining the domains of temporary mails, all you need to determine the temporary mail is to send a GET request:
https://api.testmail.top/domain/check/[email protected]&ip=8.8.8.8
with authorization header:
Authorization: Bearer XXXXXXXXXX.XXXXXXXXXX.XXXXXXXXXX
and in response you will receive a message like this if the mail turns out to be temporary:
{
"error": 0,
"result": false,
"message": "This domain is in Blacklist"
}
you will receive such an answer if the mail turns out to be trusted (something like gmail.com or yahoo.com):
{
"error": 0,
"result": true,
"message": "This domain is in Whitelist"
}
I have described error codes and more detailed instructions on this page
Upvotes: 3
Reputation: 142
It would be good if you use a third party package to help you on blocking temporary email domains. You can use MailboxValidator API, which had 300 free API credits per month. You can use the free API key with MailboxValidator CodeIgniter Email Validation Package after sign up.
Disclaimer: I am working at MailboxValidator.
Upvotes: 0
Reputation: 1230
One of the issue with disposable emails is that new domains are added daily. So, maintaining your own list isn't gonna be enough after a few days.
You can use the validator.pizza API, which is free and updated frequently.
Disclaimer: I made this API 😊
Upvotes: 7