Running Drupal 5.7 on Win32
I had openssl disabled in my php.ini file and couldn't get the Gmail smtp settings to work.
When looking at the source code, I discovered a handy help message that was never shown.

Here are my proposed changes to enable the display of this message:

  if (function_exists('openssl_open')){ //Only display the option if openssl is installed.
    $form['server']['smtp_protocol'] = array(
      '#type' => 'select',
      '#title' => t('Use encrypted protocol'),
      '#default_value' => variable_get('smtp_protocol', 'standard'),
      '#options' => array('standard' => t('No'), 'ssl' => t('Use SSL'), 'tls' => t('Use TLS')),
      '#description' => t('This allows connection to an SMTP server that requires SSL encryption such as gmail.'));
  }
  else{ //If openssl is not installed use normal protocol.
    variable_set('smtp_protocol', 'standard');
  	$form['server']['smtp_protocol'] = array(
      '#type' => 'select',
      '#title' => t('Use encrypted protocol'),
      '#default_value' => variable_get('smtp_protocol', 'standard'),
      '#options' => array('standard' => t('No')),
      '#description' => t('Your PHP installation does not have SSL enabled. See the !url page on php.net for more information. Gmail requires SSL.', array('!url' => l(t('OpenSSL Functions'), 'http://php.net/openssl'))),
      );
  }

Comments

preventingchaos’s picture

or maybe something like this?

if (function_exists('openssl_open')){ //Only display the option if openssl is installed.
  $encryption_options = array('standard' => t('No'), 'ssl' => t('Use SSL'), 'tls' => t('Use TLS'));
  $encryption_description = t('This allows connection to an SMTP server that requires SSL encryption such as gmail.');
}
else{ //If openssl is not installed use normal protocol.
  variable_set('smtp_protocol', 'standard');
  $encryption_options = array('standard' => t('No'));
  $encryption_description = t('Your PHP installation does not have SSL enabled. See the !url page on php.net for more information. Gmail requires SSL.', array('!url' => l(t('OpenSSL Functions'), 'http://php.net/openssl')));
}
$form['server']['smtp_protocol'] = array(
  '#type' => 'select',
  '#title' => t('Use encrypted protocol'),
  '#default_value' => variable_get('smtp_protocol', 'standard'),
  '#options' => $encryption_options,
  '#description' => $encryption_description);
open-keywords’s picture

Status: Active » Reviewed & tested by the community

Yes !
This is fine also

just a capital G for gmail in the first description, and it would be perfect !

oadaeh’s picture

Status: Reviewed & tested by the community » Active

It's not a patch. See here for info: http://drupal.org/patch/create

oadaeh’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

suhas448’s picture

Just enable the php_openssl (Wamp server) in php extensions you will get SSL TSL option