Add advanced control over the SSL context used when connecting to the SMTP and IMAP...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 21 Jan 2014 01:13:49 +0000 (01:13 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 21 Jan 2014 01:13:49 +0000 (01:13 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@14427 7612ce4b-ef26-0410-bec9-ea0150e637f0

30 files changed:
class/deliver/Deliver.class.php
class/deliver/Deliver_SMTP.class.php
class/deliver/Deliver_SendMail.class.php
config/config_local.example.php
doc/ChangeLog
functions/imap_general.php
include/options/folder.php
plugins/filters/filters.php
plugins/filters/options.php
plugins/filters/spamoptions.php
plugins/info/options.php
plugins/mail_fetch/fetch.php
plugins/mail_fetch/functions.php
plugins/mail_fetch/options.php
plugins/message_details/message_details_bottom.php
plugins/sent_subfolders/functions.php
plugins/spamcop/functions.php
plugins/spamcop/spamcop.php
src/compose.php
src/download.php
src/empty_trash.php
src/folders.php
src/left_main.php
src/redirect.php
src/right_main.php
src/search.php
src/vcard.php
src/view_header.php
src/view_html.php
src/view_text.php

index b36b0acf80ba34c497093df006eb2b8692a65838..73f243ab11e00b7915f2913c4728f7d32a7556b8 100644 (file)
@@ -90,7 +90,7 @@ class Deliver {
         //
         if ($reply_id) {
             global $imapConnection, $username, $imapServerAddress, 
         //
         if ($reply_id) {
             global $imapConnection, $username, $imapServerAddress, 
-                   $imapPort, $mailbox;
+                   $imapPort, $imapSslOptions, $mailbox;
 
             // try our best to use an existing IMAP handle
             //
 
             // try our best to use an existing IMAP handle
             //
@@ -103,8 +103,8 @@ class Deliver {
 
             } else {
                 $close_imap_stream = TRUE;
 
             } else {
                 $close_imap_stream = TRUE;
-                $my_imap_stream = sqimap_login($username, FALSE,
-                                               $imapServerAddress, $imapPort, 0);
+                $my_imap_stream = sqimap_login($username, FALSE, $imapServerAddress,
+                                               $imapPort, 0, $imapSslOptions);
             }
 
             sqimap_mailbox_select($my_imap_stream, $mailbox);
             }
 
             sqimap_mailbox_select($my_imap_stream, $mailbox);
@@ -453,10 +453,11 @@ class Deliver {
      * @param string  $pass     password to log into the SMTP server with
      * @param boolean $authpop  whether or not to use POP-before-SMTP authorization
      * @param string  $pop_host host name or IP to connect to for POP-before-SMTP authorization
      * @param string  $pass     password to log into the SMTP server with
      * @param boolean $authpop  whether or not to use POP-before-SMTP authorization
      * @param string  $pop_host host name or IP to connect to for POP-before-SMTP authorization
+     * @param array   $ssl_options SSL context options, see config_local.php for more details (OPTIONAL)
      *
      * @return handle $stream file handle resource to SMTP stream
      */
      *
      * @return handle $stream file handle resource to SMTP stream
      */
-    function initStream($message, $domain, $length=0, $host='', $port='', $user='', $pass='', $authpop=false, $pop_host='') {
+    function initStream($message, $domain, $length=0, $host='', $port='', $user='', $pass='', $authpop=false, $pop_host='', $ssl_options=array()) {
         return $stream;
     }
 
         return $stream;
     }
 
index 2fcd02118a22a59d1b33d08ca183865a31b9fbb4..641fbe79b3ac11e294497e48d355579462190b44 100644 (file)
@@ -62,7 +62,7 @@ class Deliver_SMTP extends Deliver {
         }
     }
 
         }
     }
 
-    function initStream($message, $domain, $length=0, $host='', $port='', $user='', $pass='', $authpop=false, $pop_host='') {
+    function initStream($message, $domain, $length=0, $host='', $port='', $user='', $pass='', $authpop=false, $pop_host='', $ssl_options=array()) {
         global $use_smtp_tls,$smtp_auth_mech;
 
         if ($authpop) {
         global $use_smtp_tls,$smtp_auth_mech;
 
         if ($authpop) {
@@ -90,9 +90,25 @@ class Deliver_SMTP extends Deliver {
             $from->mailbox = '';
         }
 
             $from->mailbox = '';
         }
 
+        // NB: Using "ssl://" ensures the highest possible TLS version
+        // will be negotiated with the server (whereas "tls://" only
+        // uses TLS version 1.0)
+        //
         if ($use_smtp_tls == 1) {
             if ((check_php_version(4,3)) && (extension_loaded('openssl'))) {
         if ($use_smtp_tls == 1) {
             if ((check_php_version(4,3)) && (extension_loaded('openssl'))) {
-                $stream = @fsockopen('tls://' . $host, $port, $errorNumber, $errorString);
+                if (function_exists('stream_socket_client')) {
+                    $server_address = 'ssl://' . $host . ':' . $port;
+                    if (!empty($ssl_options))
+                        $ssl_options = array('ssl' => $ssl_options);
+                    $ssl_context = @stream_context_create($ssl_options);
+                    $connect_timeout = ini_get('default_socket_timeout');
+                    // null timeout is broken
+                    if ($connect_timeout == 0)
+                        $connect_timeout = 30;
+                    $stream = @stream_socket_client($server_address, $errorNumber, $errorString, $connect_timeout, STREAM_CLIENT_CONNECT, $ssl_context);
+                } else {
+                    $stream = @fsockopen('ssl://' . $host, $port, $errorNumber, $errorString);
+                }
                 $this->tls_enabled = true;
             } else {
                 /**
                 $this->tls_enabled = true;
             } else {
                 /**
index 3af1a2d9fbec4e8d51836cbf16b1e59e61cce27a..a1394173261fec2e61bfccedc8fb347034244a64 100644 (file)
@@ -91,7 +91,7 @@ class Deliver_SendMail extends Deliver {
     * @return resource
     * @access public
     */
     * @return resource
     * @access public
     */
-    function initStream($message, $sendmail_path, $ignore=0, $ignore='', $ignore='', $ignore='', $ignore='', $ignore=false, $ignore='') {
+    function initStream($message, $sendmail_path, $ignore=0, $ignore='', $ignore='', $ignore='', $ignore='', $ignore=false, $ignore='', $ignore=array()) {
         $rfc822_header = $message->rfc822_header;
         $from = $rfc822_header->from[0];
         $envelopefrom = trim($from->mailbox.'@'.$from->host);
         $rfc822_header = $message->rfc822_header;
         $from = $rfc822_header->from[0];
         $envelopefrom = trim($from->mailbox.'@'.$from->host);
index a340c7c2ee9432041d88bf287568b127bd13a950..bcb482c672a5eac89a27b461d7ea83f8b309b50c 100644 (file)
@@ -27,7 +27,7 @@
  * of custom PHP session handlers.  This feature is well
  * documented in the code in include/init.php
  *
  * of custom PHP session handlers.  This feature is well
  * documented in the code in include/init.php
  *
- * hide_squirrelmail_header (must be defined as a constant:
+ * $hide_squirrelmail_header (must be defined as a constant:
  * define('hide_squirrelmail_header', 1);
  * This allows the administrator to force SquirrelMail never
  * to add its own Received headers with user information in
  * define('hide_squirrelmail_header', 1);
  * This allows the administrator to force SquirrelMail never
  * to add its own Received headers with user information in
  * (those that are displayed in a different color than other
  * "normal" mailboxes).
  *
  * (those that are displayed in a different color than other
  * "normal" mailboxes).
  *
+ * $smtpSslOptions allows more control over the SSL context used
+ * when connecting to the SMTP server over SSL/TLS.  See:
+ * http://php.net/manual/context.ssl.php
+ * For example, you can specify a CA file that corresponds
+ * to your server's certificate and make sure that the
+ * server's certificate is validated when connecting:
+ * $smtpSslOptions = array(
+ *     'cafile' => '/etc/pki/tls/certs/ca-bundle.crt',
+ *     'verify_peer' => true,
+ *     'verify_depth' => 3,
+ * );
+ *
+ * $imapSslOptions allows more control over the SSL context used
+ * when connecting to the IMAP server over SSL/TLS.  See:
+ * http://php.net/manual/context.ssl.php
+ * For example, you can specify a CA file that corresponds
+ * to your server's certificate and make sure that the
+ * server's certificate is validated when connecting:
+ * $imapSslOptions = array(
+ *     'cafile' => '/etc/pki/tls/certs/ca-bundle.crt',
+ *     'verify_peer' => true,
+ *     'verify_depth' => 3,
+ * );
  */
 
  */
 
index 9628707abcb21cb3598ac6d5baab487ea2a83c52..5f5b1d486e2b97cd03699fad92504f6efaf7a890 100644 (file)
@@ -383,6 +383,10 @@ Version 1.5.2 - SVN
     unsafe images.
   - Full date and time is used as "title" (mouseover) text for dates
     shown on the message list screen
     unsafe images.
   - Full date and time is used as "title" (mouseover) text for dates
     shown on the message list screen
+  - Added advanced control over the SSL context used when connecting
+    to the SMTP and IMAP servers over SSL/TLS (Thanks to Emmanuel
+    Dreyfus).  See $imapSslOptions and $smtpSslOptions in config_local.php
+    for more information.
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
index cc4c2f75565cdb2060963913e14c937fb606575c..9fe4e75633c7f47ed560d014363384f37b945559 100755 (executable)
@@ -670,10 +670,12 @@ function sqimap_read_data ($imap_stream, $tag_uid, $handle_errors,
  * @param int port port number to connect to
  * @param integer $tls whether to use plain text(0), TLS(1) or STARTTLS(2) when connecting.
  *  Argument was boolean before 1.5.1.
  * @param int port port number to connect to
  * @param integer $tls whether to use plain text(0), TLS(1) or STARTTLS(2) when connecting.
  *  Argument was boolean before 1.5.1.
+ * @param array $ssl_options SSL context options, see config_local.php
+ *                           for more details (OPTIONAL)
  * @return imap-stream resource identifier
  * @since 1.5.0 (usable only in 1.5.1 or later)
  */
  * @return imap-stream resource identifier
  * @since 1.5.0 (usable only in 1.5.1 or later)
  */
-function sqimap_create_stream($server,$port,$tls=0) {
+function sqimap_create_stream($server,$port,$tls=0,$ssl_options=array()) {
     global $squirrelmail_language;
 
     if (strstr($server,':') && ! preg_match("/^\[.*\]$/",$server)) {
     global $squirrelmail_language;
 
     if (strstr($server,':') && ! preg_match("/^\[.*\]$/",$server)) {
@@ -681,10 +683,25 @@ function sqimap_create_stream($server,$port,$tls=0) {
         $server = '['.$server.']';
     }
 
         $server = '['.$server.']';
     }
 
+    // NB: Using "ssl://" ensures the highest possible TLS version
+    // will be negotiated with the server (whereas "tls://" only
+    // uses TLS version 1.0)
+    //
     if ($tls == 1) {
         if ((check_php_version(4,3)) and (extension_loaded('openssl'))) {
     if ($tls == 1) {
         if ((check_php_version(4,3)) and (extension_loaded('openssl'))) {
-            /* Use TLS by prefixing "tls://" to the hostname */
-            $server = 'tls://' . $server;
+            if (function_exists('stream_socket_client')) {
+                $server_address = 'ssl://' . $server . ':' . $port;
+                if (!empty($ssl_options))
+                    $ssl_options = array('ssl' => $ssl_options);
+                $ssl_context = @stream_context_create($ssl_options);
+                $connect_timeout = ini_get('default_socket_timeout');
+                // null timeout is broken
+                if ($connect_timeout == 0)
+                    $connect_timeout = 15;
+                $imap_stream = @stream_socket_client($server_address, $error_number, $error_string, $connect_timeout, STREAM_CLIENT_CONNECT, $ssl_context);
+            } else {
+                $imap_stream = @fsockopen('ssl://' . $server, $port, $error_number, $error_string, 15);
+            }
         } else {
             require_once(SM_PATH . 'functions/display_messages.php');
             logout_error( sprintf(_("Error connecting to IMAP server: %s."), $server).
         } else {
             require_once(SM_PATH . 'functions/display_messages.php');
             logout_error( sprintf(_("Error connecting to IMAP server: %s."), $server).
@@ -694,9 +711,10 @@ function sqimap_create_stream($server,$port,$tls=0) {
                 _("Please contact your system administrator and report this error."),
                           sprintf(_("Error connecting to IMAP server: %s."), $server));
         }
                 _("Please contact your system administrator and report this error."),
                           sprintf(_("Error connecting to IMAP server: %s."), $server));
         }
+    } else {
+        $imap_stream = @fsockopen($server, $port, $error_number, $error_string, 15);
     }
 
     }
 
-    $imap_stream = @fsockopen($server, $port, $error_number, $error_string, 15);
 
     /* Do some error correction */
     if (!$imap_stream) {
 
     /* Do some error correction */
     if (!$imap_stream) {
@@ -794,11 +812,14 @@ function sqimap_create_stream($server,$port,$tls=0) {
  *                  1 = show no errors (just exit)
  *                  2 = show no errors (return FALSE)
  *                  3 = show no errors (return error string)
  *                  1 = show no errors (just exit)
  *                  2 = show no errors (return FALSE)
  *                  3 = show no errors (return error string)
+ * @param array $ssl_options SSL context options, see config_local.php
+ *                           for more details (OPTIONAL)
  * @return mixed The IMAP connection stream, or if the connection fails,
  *               FALSE if $hide is set to 2 or an error string if $hide
  *               is set to 3.
  */
  * @return mixed The IMAP connection stream, or if the connection fails,
  *               FALSE if $hide is set to 2 or an error string if $hide
  *               is set to 3.
  */
-function sqimap_login ($username, $password, $imap_server_address, $imap_port, $hide) {
+function sqimap_login ($username, $password, $imap_server_address,
+                       $imap_port, $hide, $ssl_options=array()) {
     global $color, $squirrelmail_language, $onetimepad, $use_imap_tls,
            $imap_auth_mech, $sqimap_capabilities;
 
     global $color, $squirrelmail_language, $onetimepad, $use_imap_tls,
            $imap_auth_mech, $sqimap_capabilities;
 
@@ -846,7 +867,7 @@ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $
     $host = $imap_server_address;
     $imap_server_address = sqimap_get_user_server($imap_server_address, $username);
 
     $host = $imap_server_address;
     $imap_server_address = sqimap_get_user_server($imap_server_address, $username);
 
-    $imap_stream = sqimap_create_stream($imap_server_address,$imap_port,$use_imap_tls);
+    $imap_stream = sqimap_create_stream($imap_server_address,$imap_port,$use_imap_tls,$ssl_options);
 
     if (($imap_auth_mech == 'cram-md5') OR ($imap_auth_mech == 'digest-md5')) {
         // We're using some sort of authentication OTHER than plain or login
 
     if (($imap_auth_mech == 'cram-md5') OR ($imap_auth_mech == 'digest-md5')) {
         // We're using some sort of authentication OTHER than plain or login
index 907629c09afa885a364e7eaceef8cf878b163dd9..d60e4f63af36ac613a8b3b88a6a52d6e83a913e2 100644 (file)
@@ -33,11 +33,12 @@ define('SMOPT_GRP_FOLDERSELECT', 2);
  * @return array all option information
  */
 function load_optpage_data_folder() {
  * @return array all option information
  */
 function load_optpage_data_folder() {
-    global $username, $imapServerAddress, $imapPort, $oTemplate, $nbsp,
-           $folder_prefix, $default_folder_prefix, $show_prefix_option;
+    global $username, $imapServerAddress, $imapPort, $imapSslOptions,
+           $oTemplate, $nbsp, $folder_prefix, $default_folder_prefix,
+           $show_prefix_option;
 
     /* Get some imap data we need later. */
 
     /* Get some imap data we need later. */
-    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
     $boxes = sqimap_mailbox_list($imapConnection);
 
     /* Build a simple array into which we will build options. */
     $boxes = sqimap_mailbox_list($imapConnection);
 
     /* Build a simple array into which we will build options. */
index c1612453686b3b59146c0cb1b487024d256d1ad5..2086c2cdae2ae34590c665b5ef45534703cbdafd 100644 (file)
@@ -190,9 +190,9 @@ function filters_bulkquery($filters, $IPs) {
  * @access private
  */
 function start_filters($hook_args) {
  * @access private
  */
 function start_filters($hook_args) {
-    global $imapServerAddress, $imapPort, $imap_stream, $imapConnection,
-           $UseSeparateImapConnection, $AllowSpamFilters, $filter_inbox_count,
-           $username;
+    global $imapServerAddress, $imapPort, $imapSslOptions, $imap_stream,
+           $imapConnection, $UseSeparateImapConnection, $AllowSpamFilters,
+           $filter_inbox_count, $username;
 
     /**
      * check hook that calls filtering. If filters are called by right_main_after_header,
 
     /**
      * check hook that calls filtering. If filters are called by right_main_after_header,
@@ -229,7 +229,7 @@ function start_filters($hook_args) {
     if ((!isset($imap_stream) && !isset($imapConnection)) ||
         $UseSeparateImapConnection ) {
             $stream = sqimap_login($username, false, $imapServerAddress,
     if ((!isset($imap_stream) && !isset($imapConnection)) ||
         $UseSeparateImapConnection ) {
             $stream = sqimap_login($username, false, $imapServerAddress,
-                                $imapPort, 10);
+                                $imapPort, 10, $imapSslOptions);
             $previously_connected = false;
     } else if (isset($imapConnection)) {
         $stream = $imapConnection;
             $previously_connected = false;
     } else if (isset($imapConnection)) {
         $stream = $imapConnection;
index 7395a3b938da972ce46b62e3c705e48dd178ed4e..6ea5290ef83905d1e0b4d33c5cd6f7d00fb5338e 100644 (file)
@@ -25,6 +25,7 @@ sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
 sqgetGlobalVar('theid', $theid);
 sqgetGlobalVar('action', $action, SQ_GET);
 
 sqgetGlobalVar('theid', $theid);
 sqgetGlobalVar('action', $action, SQ_GET);
+global $imapSslOptions; // in case not defined in config
 
 if (sqgetGlobalVar('filter_submit',$filter_submit,SQ_POST)) {
 
 
 if (sqgetGlobalVar('filter_submit',$filter_submit,SQ_POST)) {
 
@@ -125,7 +126,7 @@ if (sqgetGlobalVar('filter_submit',$filter_submit,SQ_POST)) {
 
     if (isset($action) && ($action == 'add' || $action == 'edit')) {
 
 
     if (isset($action) && ($action == 'add' || $action == 'edit')) {
 
-        $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+        $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
         $boxes = sqimap_mailbox_list($imapConnection);
 
         for ($a = 0, $cnt = count($boxes); $a < $cnt; $a++) {
         $boxes = sqimap_mailbox_list($imapConnection);
 
         for ($a = 0, $cnt = count($boxes); $a < $cnt; $a++) {
index 21f6c9598ed1f69d3d62b3271b57b5007ed8d3c1..8f39061512d3ea9b09960471584256c062e4dfdd 100644 (file)
@@ -23,6 +23,7 @@ include_once(SM_PATH . 'plugins/filters/filters.php');
 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
 sqgetGlobalVar('action', $action, SQ_GET);
 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
 sqgetGlobalVar('action', $action, SQ_GET);
+global $imapSslOptions; // in case not defined in config
 /* end globals */
 
 displayPageHeader($color);
 /* end globals */
 
 displayPageHeader($color);
@@ -77,7 +78,7 @@ if ($SpamFilters_YourHop == ' ') {
 
 
 if (isset($action) && $action == 'spam') {
 
 
 if (isset($action) && $action == 'spam') {
-    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
     $boxes = sqimap_mailbox_list($imapConnection);
     sqimap_logout($imapConnection);
     $numboxes = count($boxes);
     $boxes = sqimap_mailbox_list($imapConnection);
     sqimap_logout($imapConnection);
     $numboxes = count($boxes);
index 1bc14334a6b7ce8222cfdef24e340ba83cd25135..b64e107f89f52c33a3c531d6763b368263380093 100644 (file)
@@ -53,7 +53,8 @@ for($i = 0; $i <= 9; $i++){
 
 /* END GLOBALS */
 
 
 /* END GLOBALS */
 
-$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 $caps_array = get_caps($imap_stream);
 $list = array ('TEST_0',
                'TEST_1',
 $caps_array = get_caps($imap_stream);
 $list = array ('TEST_0',
                'TEST_1',
index 0383559c543eed24aa762501f408e01b37820b5f..330c0711a0be60b2384852207b0d6a373c887d4b 100644 (file)
@@ -27,6 +27,7 @@ if (!in_array('mail_fetch', $plugins)) exit;
 
 /* globals */
 sqgetGlobalVar('delimiter',  $delimiter,  SQ_SESSION);
 
 /* globals */
 sqgetGlobalVar('delimiter',  $delimiter,  SQ_SESSION);
+global $imapSslOptions; // in case not defined in config
 /* end globals */
 
 /**
 /* end globals */
 
 /**
@@ -197,7 +198,7 @@ for ($i_loop=$i_start;$i_loop<$i_stop;$i_loop++) {
     }
 
     Mail_Fetch_Status(_("Opening IMAP server"));
     }
 
     Mail_Fetch_Status(_("Opening IMAP server"));
-    $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 10);
+    $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 10, $imapSslOptions);
 
     // check if destination folder is not set, is not subscribed and is not \noselect folder
     if($mailfetch_subfolder == '' ||
 
     // check if destination folder is not set, is not subscribed and is not \noselect folder
     if($mailfetch_subfolder == '' ||
index a9b889eec4958da08d23ca8bc91648912c4bc21f..c67d97713fba1845fe225bb0cd6aaff1f2258324 100644 (file)
@@ -64,7 +64,7 @@ if (file_exists(SM_PATH . 'config/mail_fetch_config.php')) {
 function mail_fetch_login_function() {
     include_once (SM_PATH . 'functions/imap_general.php');
 
 function mail_fetch_login_function() {
     include_once (SM_PATH . 'functions/imap_general.php');
 
-    global $username, $data_dir, $imapServerAddress, $imapPort;
+    global $username, $data_dir, $imapServerAddress, $imapPort, $imapSslOptions;
 
     $mailfetch_newlog = getPref($data_dir, $username, 'mailfetch_newlog');
 
 
     $mailfetch_newlog = getPref($data_dir, $username, 'mailfetch_newlog');
 
@@ -129,7 +129,7 @@ function mail_fetch_login_function() {
                 continue;
             }
 
                 continue;
             }
 
-            $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 10);
+            $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 10, $imapSslOptions);
 
             /* log into pop server*/
             if (! $pop3->login($mailfetch_user, $mailfetch_pass)) {
 
             /* log into pop server*/
             if (! $pop3->login($mailfetch_user, $mailfetch_pass)) {
index d71d27a5e3c3a263dde540291f89c362f550cd77..d6f4f0d09c55207e11ce24005df26ebdb56bb49c 100644 (file)
@@ -59,6 +59,7 @@ sqgetGlobalVar('submit_mailfetch', $submit_mailfetch, SQ_POST);
 $mf_port = trim($mf_port);
 $mf_server = trim($mf_server);
 
 $mf_port = trim($mf_port);
 $mf_server = trim($mf_server);
 
+global $imapSslOptions; // in case not defined in config
 
 /* end globals */
 
 
 /* end globals */
 
@@ -301,7 +302,7 @@ switch( $mf_action ) {
          html_tag( 'tr' ) .
              html_tag( 'th', _("Store in Folder:"), 'right' ) .
              html_tag( 'td', '', 'left' );
          html_tag( 'tr' ) .
              html_tag( 'th', _("Store in Folder:"), 'right' ) .
              html_tag( 'td', '', 'left' );
-     $imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0);
+     $imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
      $boxes = sqimap_mailbox_list($imapConnection);
      echo '<select name="mf_subfolder">';
 
      $boxes = sqimap_mailbox_list($imapConnection);
      echo '<select name="mf_subfolder">';
 
@@ -436,7 +437,7 @@ switch( $mf_action ) {
                  html_tag( 'th', _("Store in Folder:"), 'right' ) .
                  html_tag( 'td', '', 'left' );
 
                  html_tag( 'th', _("Store in Folder:"), 'right' ) .
                  html_tag( 'td', '', 'left' );
 
-     $imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0);
+     $imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
      $boxes = sqimap_mailbox_list($imapConnection);
      echo '<select name="mf_subfolder">';
      $selected = 0;
      $boxes = sqimap_mailbox_list($imapConnection);
      echo '<select name="mf_subfolder">';
      $selected = 0;
index 52c6c9df5169d0b2ec809f7319123575c1128696..a5980ebdb469498a642c28e434365e9fc2ef7f63 100644 (file)
@@ -112,11 +112,12 @@ function CalcEntity($entString, $direction) {
  * @access public
  */
 function get_message_details($mailbox, $passed_id, $passed_ent_id=0, $stripHTML=FALSE) {
  * @access public
  */
 function get_message_details($mailbox, $passed_id, $passed_ent_id=0, $stripHTML=FALSE) {
-    global $imapServerAddress, $imapPort, $color,$msgd_8bit_in_hex, $username;
+    global $imapServerAddress, $imapPort, $imapSslOptions,
+           $color,$msgd_8bit_in_hex, $username;
 
     $returnValue = '';
 
 
     $returnValue = '';
 
-    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
     $read = sqimap_mailbox_select($imapConnection, $mailbox);
     if (!empty($passed_ent_id))
         $body = sqimap_run_command($imapConnection, "FETCH $passed_id BODY[$passed_ent_id]",true, $response, $readmessage, TRUE);
     $read = sqimap_mailbox_select($imapConnection, $mailbox);
     if (!empty($passed_ent_id))
         $body = sqimap_run_command($imapConnection, "FETCH $passed_id BODY[$passed_ent_id]",true, $response, $readmessage, TRUE);
index f1071fec2a006b44f93fb4b53341d8fd93cb94ca..9afab66191c6318e56d342d1fb9b738811efbf2a 100644 (file)
@@ -50,10 +50,10 @@ function sent_subfolders_check_handleAsSent_do($mailbox) {
 function sent_subfolders_optpage_loadhook_folders_do() {
 
     global $data_dir, $username, $optpage_data, $imapServerAddress,
 function sent_subfolders_optpage_loadhook_folders_do() {
 
     global $data_dir, $username, $optpage_data, $imapServerAddress,
-           $imapPort, $show_contain_subfolders_option, $sent_folder;
+           $imapPort, $imapSslOptions, $show_contain_subfolders_option, $sent_folder;
 
     /* Get some imap data we need later. */
 
     /* Get some imap data we need later. */
-    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
     $boxes = sqimap_mailbox_list($imapConnection);
     sqimap_logout($imapConnection);
 
     $boxes = sqimap_mailbox_list($imapConnection);
     sqimap_logout($imapConnection);
 
@@ -161,7 +161,7 @@ function save_option_sent_subfolders_base($option) {
 function sent_subfolders_update_sentfolder_do() {
     global $sent_folder, $username,
            $data_dir, $imapServerAddress, $imapPort,
 function sent_subfolders_update_sentfolder_do() {
     global $sent_folder, $username,
            $data_dir, $imapServerAddress, $imapPort,
-           $move_to_sent;
+           $imapSslOptions, $move_to_sent;
 
     sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
 
     sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
@@ -218,7 +218,7 @@ function sent_subfolders_update_sentfolder_do() {
             /* Auto-create folders, if they do not yet exist. */
             if ($sent_subfolder != 'none') {
                 /* Create the imap connection. */
             /* Auto-create folders, if they do not yet exist. */
             if ($sent_subfolder != 'none') {
                 /* Create the imap connection. */
-                $ic = sqimap_login($username, false, $imapServerAddress, $imapPort, 10);
+                $ic = sqimap_login($username, false, $imapServerAddress, $imapPort, 10, $imapSslOptions);
 
                 $boxes = false;
                 /**
 
                 $boxes = false;
                 /**
index 8798de1550268f121a337698c53199c7df47a2d4..5d0d4c668c32395e36650c96a706456211fe239b 100644 (file)
@@ -134,12 +134,12 @@ function spamcop_options_function() {
  */
 function spamcop_while_sending_function() {
     global $mailbox, $spamcop_delete, $spamcop_save, $spamcop_is_composing, $auto_expunge,
  */
 function spamcop_while_sending_function() {
     global $mailbox, $spamcop_delete, $spamcop_save, $spamcop_is_composing, $auto_expunge,
-           $username, $imapServerAddress, $imapPort;
+           $username, $imapServerAddress, $imapPort, $imapSslOptions;
 
     if (sqgetGlobalVar('spamcop_is_composing' , $spamcop_is_composing)) {
         // delete spam message
         if ($spamcop_delete) {
 
     if (sqgetGlobalVar('spamcop_is_composing' , $spamcop_is_composing)) {
         // delete spam message
         if ($spamcop_delete) {
-            $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+            $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
             sqimap_mailbox_select($imapConnection, $mailbox);
             sqimap_msgs_list_delete($imapConnection, $mailbox, array($spamcop_is_composing));
             if ($auto_expunge)
             sqimap_mailbox_select($imapConnection, $mailbox);
             sqimap_msgs_list_delete($imapConnection, $mailbox, array($spamcop_is_composing));
             if ($auto_expunge)
index 2d0d0acd0f8db171544a6969bca04ced4520f4b4..abaee516c7caddb3ebac35d70621f60fcb0c1e2e 100644 (file)
@@ -66,7 +66,8 @@ if (! is_plugin_enabled('spamcop')) {
     exit();
 }
 
     exit();
 }
 
-    $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+    global $imapSslOptions; // in case not defined in config
+    $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
     sqimap_mailbox_select($imap_stream, $mailbox);
 
     if ($spamcop_method == 'quick_email' ||
     sqimap_mailbox_select($imap_stream, $mailbox);
 
     if ($spamcop_method == 'quick_email' ||
index c3f0f426be5a419336988b79b30c6b6c20b75568..a84c33b8e74beb5a2df41dd3a37a9d9784b23cae 100644 (file)
@@ -41,6 +41,7 @@ require_once(SM_PATH . 'class/deliver/Deliver.class.php');
 require_once(SM_PATH . 'functions/addressbook.php');
 require_once(SM_PATH . 'functions/forms.php');
 require_once(SM_PATH . 'functions/identity.php');
 require_once(SM_PATH . 'functions/addressbook.php');
 require_once(SM_PATH . 'functions/forms.php');
 require_once(SM_PATH . 'functions/identity.php');
+global $imapSslOptions; // in case not defined in config
 
 /* --------------------- Get globals ------------------------------------- */
 
 
 /* --------------------- Get globals ------------------------------------- */
 
@@ -429,7 +430,7 @@ if ($draft) {
         $draft_message = _("Draft Email Saved");
         /* If this is a resumed draft, then delete the original */
         if(isset($delete_draft)) {
         $draft_message = _("Draft Email Saved");
         /* If this is a resumed draft, then delete the original */
         if(isset($delete_draft)) {
-            $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, false);
+            $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, false, $imapSslOptions);
             sqimap_mailbox_select($imap_stream, $draft_folder);
             // force bypass_trash=true because message should be saved when deliverMessage() returns true.
             // in current implementation of sqimap_msgs_list_flag() single message id can
             sqimap_mailbox_select($imap_stream, $draft_folder);
             // force bypass_trash=true because message should be saved when deliverMessage() returns true.
             // in current implementation of sqimap_msgs_list_flag() single message id can
@@ -542,7 +543,7 @@ if ($send) {
 
         /* if it is resumed draft, delete draft message */
         if ( isset($delete_draft)) {
 
         /* if it is resumed draft, delete draft message */
         if ( isset($delete_draft)) {
-            $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, false);
+            $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, false, $imapSslOptions);
             sqimap_mailbox_select($imap_stream, $draft_folder);
             // bypass_trash=true because message should be saved when deliverMessage() returns true.
             // in current implementation of sqimap_msgs_list_flag() single message id can
             sqimap_mailbox_select($imap_stream, $draft_folder);
             // bypass_trash=true because message should be saved when deliverMessage() returns true.
             // in current implementation of sqimap_msgs_list_flag() single message id can
@@ -773,7 +774,7 @@ function getforwardSubject($subject)
 function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $session='') {
     global $editor_size, $default_use_priority, $body, $idents,
         $use_signature, $data_dir, $username,
 function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $session='') {
     global $editor_size, $default_use_priority, $body, $idents,
         $use_signature, $data_dir, $username,
-        $key, $imapServerAddress, $imapPort, 
+        $key, $imapServerAddress, $imapPort, $imapSslOptions,
         $composeMessage, $body_quote, $request_mdn, $request_dr,
         $mdn_user_support, $languages, $squirrelmail_language,
         $default_charset, $do_not_reply_to_self;
         $composeMessage, $body_quote, $request_mdn, $request_dr,
         $mdn_user_support, $languages, $squirrelmail_language,
         $default_charset, $do_not_reply_to_self;
@@ -790,7 +791,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
 
     if ($passed_id) {
         $imapConnection = sqimap_login($username, false, $imapServerAddress,
 
     if ($passed_id) {
         $imapConnection = sqimap_login($username, false, $imapServerAddress,
-                $imapPort, 0);
+                $imapPort, 0, $imapSslOptions);
 
         sqimap_mailbox_select($imapConnection, $mailbox);
         $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
 
         sqimap_mailbox_select($imapConnection, $mailbox);
         $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
@@ -1680,7 +1681,7 @@ function deliverMessage(&$composeMessage, $draft=false) {
         $username, $identity, $idents, $data_dir,
         $request_mdn, $request_dr, $default_charset, $useSendmail,
         $domain, $action, $default_move_to_sent, $move_to_sent,
         $username, $identity, $idents, $data_dir,
         $request_mdn, $request_dr, $default_charset, $useSendmail,
         $domain, $action, $default_move_to_sent, $move_to_sent,
-        $imapServerAddress, $imapPort, $sent_folder, $key;
+        $imapServerAddress, $imapPort, $imapSslOptions, $sent_folder, $key;
 
     $rfc822_header = $composeMessage->rfc822_header;
 
 
     $rfc822_header = $composeMessage->rfc822_header;
 
@@ -1777,13 +1778,13 @@ function deliverMessage(&$composeMessage, $draft=false) {
     if (!$useSendmail && !$draft) {
         require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php');
         $deliver = new Deliver_SMTP();
     if (!$useSendmail && !$draft) {
         require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php');
         $deliver = new Deliver_SMTP();
-        global $smtpServerAddress, $smtpPort, $pop_before_smtp, $pop_before_smtp_host;
+        global $smtpServerAddress, $smtpPort, $smtpSslOptions, $pop_before_smtp, $pop_before_smtp_host;
 
         $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false;
         if (empty($pop_before_smtp_host)) $pop_before_smtp_host = $smtpServerAddress;
         get_smtp_user($user, $pass);
         $stream = $deliver->initStream($composeMessage,$domain,0,
 
         $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false;
         if (empty($pop_before_smtp_host)) $pop_before_smtp_host = $smtpServerAddress;
         get_smtp_user($user, $pass);
         $stream = $deliver->initStream($composeMessage,$domain,0,
-                $smtpServerAddress, $smtpPort, $user, $pass, $authPop, $pop_before_smtp_host);
+                $smtpServerAddress, $smtpPort, $user, $pass, $authPop, $pop_before_smtp_host, $smtpSslOptions);
     } elseif (!$draft) {
         require_once(SM_PATH . 'class/deliver/Deliver_SendMail.class.php');
         global $sendmail_path, $sendmail_args;
     } elseif (!$draft) {
         require_once(SM_PATH . 'class/deliver/Deliver_SendMail.class.php');
         global $sendmail_path, $sendmail_args;
@@ -1800,7 +1801,7 @@ function deliverMessage(&$composeMessage, $draft=false) {
     } elseif ($draft) {
         global $draft_folder;
         $imap_stream = sqimap_login($username, false, $imapServerAddress,
     } elseif ($draft) {
         global $draft_folder;
         $imap_stream = sqimap_login($username, false, $imapServerAddress,
-                $imapPort, 0);
+                $imapPort, 0, $imapSslOptions);
         if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) {
             require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
             $imap_deliver = new Deliver_IMAP();
         if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) {
             require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
             $imap_deliver = new Deliver_IMAP();
@@ -1836,7 +1837,7 @@ function deliverMessage(&$composeMessage, $draft=false) {
         plain_error_message($msg);
     } else {
         unset ($deliver);
         plain_error_message($msg);
     } else {
         unset ($deliver);
-        $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+        $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 
 
         // mark as replied or forwarded if applicable
 
 
         // mark as replied or forwarded if applicable
index 8f0d848b47334862cf09b4ea8783ef37974d32b8..780ff9f586fc883869bdc2b4aac1e9bf4c7da651 100644 (file)
@@ -58,7 +58,8 @@ set_my_charset();
 
 /* end globals */
 
 
 /* end globals */
 
-$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 $aMailbox = sqm_api_mailbox_select($imapConnection, $account, $mailbox,array(),array());
 
 if (isset($aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT']) &&
 $aMailbox = sqm_api_mailbox_select($imapConnection, $account, $mailbox,array(),array());
 
 if (isset($aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT']) &&
index eeeb537393af6d0b8add9ef46df78f2acbf17cfe..b3f4c476fbc1cc09efadf9cc793c2f38c250aa97 100644 (file)
@@ -34,7 +34,8 @@ sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 sqgetGlobalVar('smtoken', $submitted_token, SQ_GET, '');
 sm_validate_security_token($submitted_token, -1, TRUE);
 
 sqgetGlobalVar('smtoken', $submitted_token, SQ_GET, '');
 sm_validate_security_token($submitted_token, -1, TRUE);
 
-$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 
 $mailbox = $trash_folder;
 $boxes = sqimap_mailbox_list($imap_stream);
 
 $mailbox = $trash_folder;
 $boxes = sqimap_mailbox_list($imap_stream);
index 78198e39d8cb0ad613f9eaf1f17f65ab0ae558d9..87b48b0498f9086b2c22e6e976c080ad42ae2cad 100644 (file)
@@ -34,7 +34,8 @@ sqgetGlobalVar('smtoken', $submitted_token, SQ_POST, '');
 
 /* end of get globals */
 
 
 /* end of get globals */
 
-$imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 
 /* switch to the right function based on what the user selected */
 if ( sqgetGlobalVar('smaction', $action, SQ_POST) ) {
 
 /* switch to the right function based on what the user selected */
 if ( sqgetGlobalVar('smaction', $action, SQ_POST) ) {
index 1b77a6e515057c30bcc969f4ee3f5451689034db..5f75070b82cbf6cf227c5f2c3eebe96eea5b2507 100644 (file)
@@ -38,7 +38,8 @@ sqgetGlobalVar('unfold', $unfold, SQ_GET);
 
 // open a connection on the imap port (143)
 // why hide the output?
 
 // open a connection on the imap port (143)
 // why hide the output?
-$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, true);
+global $imapSslOptions; // in case not defined in config
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, true, $imapSslOptions);
 
 /**
  * Using stristr since very old preferences may contain "None" and "none".
 
 /**
  * Using stristr since very old preferences may contain "None" and "none".
index d6aa6f8ffb1f61feb3a675823367cef43e44ad82..c8af13671c83d6d56448d65f41f85d6d1d755bfd 100644 (file)
@@ -71,7 +71,8 @@ if ($force_username_lowercase) {
 }
 
 /* Verify that username and password are correct. */
 }
 
 /* Verify that username and password are correct. */
-$imapConnection = sqimap_login($login_username, $key, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imapConnection = sqimap_login($login_username, $key, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 /* From now on we are logged it. If the login failed then sqimap_login handles it */
 
 /**
 /* From now on we are logged it. If the login failed then sqimap_login handles it */
 
 /**
index 41960632d02fbadc37ad407c884ef4da76349232..ea2f3af59ceaa01dc274a82630e22dabf647917e 100644 (file)
@@ -88,7 +88,8 @@ if ( sqgetGlobalVar('account', $account, SQ_GET) ) {
 
 /* Open an imap connection */
 
 
 /* Open an imap connection */
 
-$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 
 $mailbox = (isset($mailbox) && $mailbox) ? $mailbox : 'INBOX';
 
 
 $mailbox = (isset($mailbox) && $mailbox) ? $mailbox : 'INBOX';
 
index 15d4886a2a16ad06897ee1c5ce2b4171312f5fb9..ce868b732136361c281c90321cf975cf627772f7 100644 (file)
@@ -1321,7 +1321,8 @@ if ($search_advanced) {
 uasort($imap_asearch_options, 'asearch_unhtml_strcoll');
 
 /* open IMAP connection */
 uasort($imap_asearch_options, 'asearch_unhtml_strcoll');
 
 /* open IMAP connection */
-$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 
 
 /* get mailboxes once here */
 
 
 /* get mailboxes once here */
index dc9ed7c2692c0a27d094f299f12c1cfbd9e7ad34..e3529c8efe1908b738a1ab334d95fc727dfc8490 100644 (file)
@@ -41,7 +41,8 @@ sqgetGlobalVar('ent_id', $ent_id, SQ_GET);
 sqgetGlobalVar('startMessage', $startMessage, SQ_GET);
 /* end globals */
 
 sqgetGlobalVar('startMessage', $startMessage, SQ_GET);
 /* end globals */
 
-$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 sqimap_mailbox_select($imapConnection, $mailbox);
 
 displayPageHeader($color);
 sqimap_mailbox_select($imapConnection, $mailbox);
 
 displayPageHeader($color);
index ee151785e2b3f75ac6ef79a351945ade25e221b4..65214f91a0c92d43b9ae86a64de98827e1c8af19 100644 (file)
@@ -93,8 +93,9 @@ if ( !sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET) ) {
 }
 sqgetGlobalVar('delimiter',  $delimiter,    SQ_SESSION);
 
 }
 sqgetGlobalVar('delimiter',  $delimiter,    SQ_SESSION);
 
+global $imapSslOptions; // in case not defined in config
 $imapConnection = sqimap_login($username, false, $imapServerAddress,
 $imapConnection = sqimap_login($username, false, $imapServerAddress,
-                               $imapPort, 0);
+                               $imapPort, 0, $imapSslOptions);
 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
 $header = parse_viewheader($imapConnection,$passed_id, $passed_ent_id);
 
 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox, false, false, true);
 $header = parse_viewheader($imapConnection,$passed_id, $passed_ent_id);
 
index e4355a3cc9fc283f1120280de331fced9f3e8410..185349f8e0fa9d73b85dfed74456782cd750dbd6 100644 (file)
@@ -38,7 +38,8 @@ sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 
 // TODO: add required var checks here.
 
 
 // TODO: add required var checks here.
 
-$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 $mbx_response = sqimap_mailbox_select($imap_stream, $mailbox);
 
 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
 $mbx_response = sqimap_mailbox_select($imap_stream, $mailbox);
 
 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
index 94655a01154d55aaaeeaf6db63682f099e2fecd5..382d9ddee92529a9d51685135d7a813ebdf851c2 100644 (file)
@@ -29,7 +29,8 @@ sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET);
 sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
 sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 
 sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
 sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 
-$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
+global $imapSslOptions; // in case not defined in config
+$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imapSslOptions);
 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
 
 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
 
 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];