Detect Disposable Email with Garbage Domain
Asked Answered
B

4

5

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.

enter image description here

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.

Boob answered 7/11, 2018 at 8:23 Comment(4)
Where is the code you tried?Letishaletitia
@IslamElshobokshy updated.Boob
How do you logically determine what is garbage and what is not?Boggers
As shown in the image, you can consider it as garbage disposable domain if it is random string and not readable.Unlike other disposable domains like mailinator.com, its readable.Boob
S
7

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 😊

Swats answered 8/11, 2018 at 14:24 Comment(6)
Wow Amazing!. Its really free? Thanks @tompec. Its very helpful. I wish I could have higher limit. :)Boob
Yes it is :) Contact me on twitter if you want a higher limit @thomaspetracco. Cheers.Swats
Tried some domains from temp-mail.org and validator.pizza says its not disposable.Rolle
@Tompec You cannot state "it is free", it is misleading. Actually it has both a free and a Pro option, as all validators around.Conductive
@Conductive We've added a paid plans since that post 4 years ago because some people needed large volumes. But our API is still free to use and requires no signup.Swats
Excelent service!Medicable
M
3

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

Mcneil answered 11/5, 2021 at 21:16 Comment(0)
M
0

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.

Mufti answered 21/10, 2020 at 9:18 Comment(0)
C
0

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
Castra answered 26/5, 2024 at 15:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.