I have a site where users send messages to one another using the Private Message module, and they are notified of messages by email.
On this site, there are a variety of spammers, scammers, and abusive users who attempt to register multiple accounts using disposable email addresses.
I know it's impossible to block every possible disposable email address domain, but is there anything in the Drupal world that can help me?
I considered white-listing valid domains, but my user base is too diverse for this.
The only project I could find on drupal.org has been abandoned.
There are third-party APIs such as this one.
At the moment, I'm blocking them manually using this code:
/**
* Custom validation function from the Domain Registration module (1.0).
*
* Checks if the domain in the email address is on a list of blocked domains.
* @param $form
* @param $form_state
*/
function MYMODULE_domain_registration_user_register_validate(&$form, &$form_state) {
$default_message = t('You are not allowed to register for an account on this site. Contact support for more information.');
$mail = explode('@', $form_state['values']['mail']);
$exact_domains = array(
'ad.drupaler.org',
'drupaler.org',
);
$partial_domains = array(
'pp.ua',
'guerrilamail',
);
if (isset($mail[1]) && !empty($exact_domains)) {
if (in_array($mail[1], $exact_domains) || MYMODULE_contactinfo_check_banned_words($mail[1], $partial_domains)) {
form_set_error('account', variable_get('domain_registration_message', $default_message));
}
}
}