You are here

public static function SendinblueManager::updateSmtpDetails in SendinBlue 7

Same name and namespace in other branches
  1. 7.2 includes/sendinblue.manage.inc \SendinblueManager::updateSmtpDetails()

Update smtp details.

Return value

string|bool A access token if exist, else 0.

3 calls to SendinblueManager::updateSmtpDetails()
sendinblue_login_form_validate in includes/sendinblue_home.admin.inc
Validation Handler of Login form.
sendinblue_send_email_form in includes/sendinblue_home.admin.inc
Form to send email of Home page.
sendinblue_send_email_form_validate in includes/sendinblue_home.admin.inc
Validation Handler of Form to send email of Home page.

File

includes/sendinblue.manage.inc, line 567
Manage class file.

Class

SendinblueManager
Basic manager of module.

Code

public static function updateSmtpDetails() {
  $access_key = variable_get(self::ACCESS_KEY, '');
  $mailin = new SendinblueMailin(self::API_URL, $access_key);
  $response = $mailin
    ->getSmtpDetails();
  if ($response['code'] == 'success') {
    if ($response['data']['relay_data']['status'] == 'enabled') {
      $smtp_details = $response['data']['relay_data']['data'];
      variable_set(self::SMTP_DETAILS, $smtp_details);
      return $smtp_details;
    }
    else {
      $smtp_details = array(
        'relay' => FALSE,
      );
      variable_set('sendinblue_on', 0);
      variable_set(self::SMTP_DETAILS, $smtp_details);
      return $smtp_details;
    }
  }
  return FALSE;
}