How to block Disposable Email Addresses in your website's registration form?

后端 未结 11 2182
天命终不由人
天命终不由人 2020-11-29 23:55

I would like to know of the possible ways to block disposable email addresses from registering in my website.

For simplicity, let\'s take the example where the regi

11条回答
  •  再見小時候
    2020-11-30 00:33

    This would be tough to hardcode as disposable/temporary email domains appear every day from services like 10minutemail, guerrillamail etc. That being said you're probably better off integrating some managed up to date servcie like antideo email health API for example.

    Endpoint:

    api.antideo.com/email/nzk41997@xzsok.com

    JSON response

    {
      "email": "nzk41997@xzsok.com",
      "free_provider": false,
      "spam": false,
      "scam": false,
      "disposable": true
    }
    

    Your php code will then look something like:

    $request = file_get_contents('http://api.antideo.com/email/nzk41997@xzsok.com');
    $response = gzdecode($request);
    $result = json_decode($response);
    

    And then just look for the boolean like

    if($result->disposable == true){
      // EMAIL IS TEMPORARY/DISPOSABLE
    } else {
      // PERFORM YOUR ACTION
    }
    

    They also provide details about if the emails is known spammer/scammer or it's from a free provider like gmail, yahoo etc.

    Disclaimer:

    I know the guys from Antideo personally and I took a small part of building the service with them.

提交回复
热议问题