diff --git a/lib/roundcube/config/config.inc.php b/lib/roundcube/config/config.inc.php
index 025b119..1de991d 100644
--- a/lib/roundcube/config/config.inc.php
+++ b/lib/roundcube/config/config.inc.php
@@ -117,3 +117,9 @@ $config['dst_active'] = true;
 // focus new window if new message arrives
 $config['focus_on_new_message'] = true;
 
+$config['imap_conn_options'] = array(
+     'ssl' => array(
+        'verify_peer' => false,
+        'verify_peer_name' => false
+      ),
+);
diff --git a/lib/squirrelmail/config/config_local.php b/lib/squirrelmail/config/config_local.php
index 4066326..9fae27f 100644
--- a/lib/squirrelmail/config/config_local.php
+++ b/lib/squirrelmail/config/config_local.php
@@ -22,6 +22,12 @@ if( is_dir( $tmpdir ) === false ) {
 
 ini_set('include_path', '/usr/local/interworx/lib/pear' . ':'. ini_get('include_path') );
 ini_set( 'session.save_path', '/home/interworx/lib/squirrelmail/sessions' );
-error_reporting( E_ALL & ~E_COMPILE_WARNING & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT );
 
+$imap_stream_options = array(
+  'ssl' => array(
+    'verify_peer' => false,
+    'verify_peer_name' => false,
+  )
+);
 
+error_reporting( E_ALL & ~E_COMPILE_WARNING & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT );
diff --git a/lib/squirrelmail/plugins/add_address/add_addresses.php b/lib/squirrelmail/plugins/add_address/add_addresses.php
index acab3f8..c389908 100644
--- a/lib/squirrelmail/plugins/add_address/add_addresses.php
+++ b/lib/squirrelmail/plugins/add_address/add_addresses.php
@@ -305,9 +305,10 @@ else
       include_once(SM_PATH . 'functions/date.php');
       include_once(SM_PATH . 'functions/url_parser.php');
 
+      global $imap_stream_options; // in case not defined in config
       // last parameter here guarantees that login errors will be handled for us
       //
-      $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+      $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
       $aMailbox = sqm_api_mailbox_select($imapConnection, $account, $mailbox, array('setindex' => $what, 'offset' => $startMessage), array());
       if (isset($aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT']))
          $message = $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'];
@@ -341,10 +342,10 @@ else
    else
    {
       sqgetGlobalVar('key', $key, SQ_COOKIE);
-
+      global $imap_stream_options; // in case not defined in config
       // last parameter here guarantees that login errors will be handled for us
       //
-      $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+      $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0, $imap_stream_options);
       global $uid_support;
       if (!sqgetGlobalVar('messages', $messages, SQ_SESSION)) 
          $messages = array();
diff --git a/lib/squirrelmail/plugins/add_address/functions.php b/lib/squirrelmail/plugins/add_address/functions.php
index 4b4e717..002bef0 100644
--- a/lib/squirrelmail/plugins/add_address/functions.php
+++ b/lib/squirrelmail/plugins/add_address/functions.php
@@ -384,7 +384,8 @@ function aa_find_addresses($message, $mailbox=NULL, $passed_id=NULL,
       if (check_sm_version(1, 5, 2)) $key = FALSE;
       if (!is_resource($imapConnection))
       {
-         $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+         global $imap_stream_options; // in case not defined in config
+         $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0, $imap_stream_options );
          $close_connection = TRUE;
       }
 
diff --git a/lib/squirrelmail/plugins/sasql/move_to.php b/lib/squirrelmail/plugins/sasql/move_to.php
index 39f9535..2068f60 100644
--- a/lib/squirrelmail/plugins/sasql/move_to.php
+++ b/lib/squirrelmail/plugins/sasql/move_to.php
@@ -47,9 +47,10 @@ sqgetGlobalVar('move_id',   $move_id,   SQ_FORM);
 sqgetGlobalVar('location',        $location,        SQ_FORM);
 //sqgetGlobalVar('',   $,   SQ_FORM);
 
+global $imap_stream_options; // in case not defined in config
 /* end of get globals */
 
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0, $imap_stream_options);
 $mbx_response=sqimap_mailbox_select($imapConnection, $mailbox);
 
 $location = set_url_var($location,'composenew',0,false);
diff --git a/lib/squirrelmail/plugins/sasql/sasql_api.php b/lib/squirrelmail/plugins/sasql/sasql_api.php
index e4d1545..05f3c38 100644
--- a/lib/squirrelmail/plugins/sasql/sasql_api.php
+++ b/lib/squirrelmail/plugins/sasql/sasql_api.php
@@ -58,10 +58,10 @@ function sasql_purgeSpam ($folder = '')
   sqgetGlobalVar('key', $key, SQ_COOKIE);
   sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
   sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
-
+  global $imap_stream_options; // in case not defined in config
   /* finished globals */
   
-  $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+  $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0, $imap_stream_options);
 
   sqimap_mailbox_list($imap_stream);
 
diff --git a/lib/squirrelmail/plugins/sasql/sasql_hooks.php b/lib/squirrelmail/plugins/sasql/sasql_hooks.php
index 302d00a..c555dc1 100644
--- a/lib/squirrelmail/plugins/sasql/sasql_hooks.php
+++ b/lib/squirrelmail/plugins/sasql/sasql_hooks.php
@@ -57,8 +57,8 @@ function sasql_autocreate_spam_folder () {
   } else {
     $boxes = array($spam_folder);
   }
-
-  $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+  global $imap_stream_options; // in case not defined in config
+  $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0, $imap_stream_options);
 
   foreach ($boxes as $box) {
 
