I would like to send an email to some users, when i put my Drupal-7 website in maintenance mode. Are there any hooks that allow me to do this? I could not figure it out for myself.
1 Answer
As @Clive said you can use hook_form_alter() or hook_form_FORM_ID_alter() and add extra submit handler to send email notifications.
function YOURMODULE_form_system_site_maintenance_mode_alter(&$form, &$form_state, $form_id) {
$form['#submit'][] = 'email_system_settings_form_submit';
}
function email_system_settings_form_submit($form, &$form_state) {
// Add your email code here
}
hook_form_alter
and add a submit handler which sends the email. If by drush/something else, you'd probably need to script it as part of that op