You are here

function smtp_current_provider in SMTP Authentication Support 7.2

Auxiliar function that retrieves the current SMTP provider. It can be used in other places of the code to force a provider, using the $provider param.

Parameters

string $provider: The machine name of the provider to be used on this code execution. Be aware that this parameter only changes the provider on drupal_static time, so if you need to change the default provider on all requests, please use the administration interface.

Return value

The machine name of the current provider.

2 calls to smtp_current_provider()
SmtpMailSystem::mailWithoutQueue in ./smtp.mail.inc
smtp_provider_variable_get in ./smtp.module
Get the variable value of the enabled provider

File

./smtp.module, line 244
Enables Drupal to send e-mail directly to an SMTP server.

Code

function smtp_current_provider($provider = NULL) {
  static $drupal_static;
  if (!isset($drupal_static)) {
    $drupal_static =& drupal_static(__FUNCTION__);
  }
  $current_provider =& $drupal_static;
  if (isset($provider)) {
    $current_provider = $provider;
  }
  elseif (!isset($current_provider)) {

    // The default fallback is the default provider
    $default_provider = variable_get('smtp_default_provider', '');
    $current_provider = $default_provider;
  }
  return $current_provider;
}