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.
Advertisement
Answer
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 ????