I would just summarize final code.
// restrict particular email domains
function cust_restrict_mail_providers1() {
$authorized_providers = array(
'hotmail.com',
'mail.live.com',
'live.com',
'gmail.com'
);
$current_provider = preg_replace('/^.*@(.*)$/i', '$1', Params::getParam('s_email'));
if (in_array($current_provider, $authorized_providers)) {
osc_add_flash_error_message(_m('Email domain is blocked'));
osc_redirect_to(osc_register_account_url());
exit;
}
}
osc_add_hook('before_user_register', 'cust_restrict_mail_providers1');
// only allow particular email domains
function cust_restrict_mail_providers2() {
$authorized_providers = array(
'hotmail.com',
'mail.live.com',
'live.com',
'gmail.com'
);
$current_provider = preg_replace('/^.*@(.*)$/i', '$1', Params::getParam('s_email'));
if (!in_array($current_provider, $authorized_providers)) {
osc_add_flash_error_message(_m('Email domain is not allowed'));
osc_redirect_to(osc_register_account_url());
exit;
}
}
osc_add_hook('before_user_register', 'cust_restrict_mail_providers2');