Skip to content

Instantly share code, notes, and snippets.

@navt
Last active March 28, 2025 04:58
Show Gist options
  • Select an option

  • Save navt/42b29a7bd8e0beb2625c3662b6a869ce to your computer and use it in GitHub Desktop.

Select an option

Save navt/42b29a7bd8e0beb2625c3662b6a869ce to your computer and use it in GitHub Desktop.
Проверка MX записи для домена почты при регистрации
<?php
/* /system/controllers/auth/hooks/registration_validation.php */
class onAuthRegistrationValidation extends cmsAction {
public function run($data){
list($errors, $user) = $data;
if ($errors != []) {
return $data;
}
list(, $domain) = explode('@', $user['email']);
if (checkdnsrr($domain, 'MX') === false) {
$errors['email'] = "MX запись для {$domain} не найдена.";
return [$errors, $user];
}
return $data;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment