You are here

function swiftmailer_get_encryption_options in Swift Mailer 8

Same name and namespace in other branches
  1. 8.2 includes/helpers/utilities.inc \swiftmailer_get_encryption_options()
  2. 7 includes/helpers/utilities.inc \swiftmailer_get_encryption_options()

Returns a list of available encryption options.

Return value

array A list of available encryption options.

1 call to swiftmailer_get_encryption_options()
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.

File

includes/helpers/utilities.inc, line 14
This file contains general utility functions.

Code

function swiftmailer_get_encryption_options() {

  // Define a variable to hold the various encryption options.
  $encryption_options[0] = t('No Encryption');

  // Get available encryption options on this system.
  $system_transports = stream_get_transports();

  // Validate wether this system supports SSL.
  if (in_array('ssl', $system_transports)) {
    $encryption_options['ssl'] = t('SSL');
  }

  // Validate wether this system supports TLS.
  if (in_array('tls', $system_transports)) {
    $encryption_options['tls'] = t('TLS');
  }

  // Return available options.
  return $encryption_options;
}