function mail_debugger_callback_valid_contrib_mail in Mail Debugger 7.2
Validate parameters for the contributed module mail
_state
Parameters
type $form:
1 string reference to 'mail_debugger_callback_valid_contrib_mail'
- mail_debugger_callback in includes/
mail_debugger.callback.inc - Callback for drupal_get_form
File
- includes/
mail_debugger.callback.inc, line 341
Code
function mail_debugger_callback_valid_contrib_mail($form, &$form_state) {
try {
$php = $form_state['values']['contrib']['param'];
if (!empty($php)) {
$param = eval($form_state['values']['contrib']['param']);
if (!is_array($param)) {
form_set_error("contrib][param", t("The PHP code to populate \$param must be an array"));
}
}
} catch (Exception $ex) {
form_set_error("contrib][param", $ex
->getMessage());
}
if (!valid_email_address($form_state['values']['contrib']['to'])) {
form_set_error('contrib][to', t('Enter a valid e-mail address'));
}
if (!empty($form_state['values']['contrib']['from']) && !valid_email_address($form_state['values']['contrib']['from'])) {
form_set_error('contrib][from', t('Enter a valid e-mail address'));
}
if (empty($form_state['values']['contrib']['key'])) {
form_set_error('contrib][key', t('Enter a valid e-mail address'));
}
}