You are here

function sendinblue_send_email_form_validate in SendinBlue 7

Same name and namespace in other branches
  1. 7.2 includes/sendinblue_home.admin.inc \sendinblue_send_email_form_validate()

Validation Handler of Form to send email of Home page.

File

includes/sendinblue_home.admin.inc, line 157
Sendinblue module home admin settings.

Code

function sendinblue_send_email_form_validate($form, &$form_state) {
  $sendinblue_on = $form_state['values']['sendinblue_on'];
  $send_email = $form_state['values']['sendinblue_to_email'];
  if ($sendinblue_on == '1') {
    $smtp_details = variable_get(SendinblueManager::SMTP_DETAILS, NULL);
    if ($smtp_details == NULL) {
      $smtp_details = SendinblueManager::updateSmtpDetails();
    }
    if ($smtp_details['relay'] == FALSE) {
      $sendinblue_on = 0;
    }
  }
  variable_set('sendinblue_on', $sendinblue_on);
  if ($send_email != '') {
    if (!valid_email_address($send_email)) {
      form_set_error('sendinblue_to_email', t('The email address is invalid.'));
      return;
    }
  }
}