<?php
	//set_time_limit(180);
	//2018-12-21 - Increase execution time limit to see if eventual completion fixes hangs??
	set_time_limit(360);
/*
 +-----------------------------------------------------------------------+
 | Local configuration for the Roundcube Webmail installation.           |
 |                                                                       |
 | This is a sample configuration file only containing the minumum       |
 | setup required for a functional installation. Copy more options       |
 | from defaults.inc.php to this file to override the defaults.          |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
 | See the README file for a full license statement.                     |
 +-----------------------------------------------------------------------+
*/
// this is a good page for RoundCube config settings:
//https://docs.kolab.org/administrator-guide/roundcube-settings-reference.html


$config = array();

// Database connection string (DSN) for read+write operations
// Format (compatible with PEAR MDB2): db_provider://user:password@host/database
// Currently supported db_providers: mysql, pgsql, sqlite, mssql or sqlsrv
// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
// NOTE: for SQLite use absolute path: 'sqlite:////full/path/to/sqlite.db?mode=0646'


//2018-06-13 - switched to mysql to hopefully fix continued issue where inbox wouldn't load & got timeout errors
$config['db_dsnw'] = 'mysql://roundcubemail:[[[-REDACTED-]]]@myserver.local/roundcubemail';
$config['db_dsnr'] = 'mysql://roundcubemail:[[[-REDACTED-]]]@myserver.local/roundcubemail';

//2018-08-29 - added this 
//$config['db_persistent'] = true;
//2018-10-24 - disabled persistence to see if that stops these errors in mariaDB:
//03:22 355 [Warning] Aborted connection 355 to db: 'roundcubemail' user: 'roundcubemail' host: 'winserver.local' (Got timeout reading communication packets)
$config['db_persistent'] = false;



// ----------------------------------
// IMAP
// ----------------------------------

// The mail host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
//          required to match old user data records with the new host.
//$config['default_host'] = 'ssl://localhost:143';
//$config['default_host'] = 'tls://localhost:143';
///STARTCOM_SETTING:  $config['default_host'] = 'ssl://mydomain.com:143';
$config['default_host'] = 'ssl://mydomain.com:143';


// TCP port used for IMAP connections
$config['default_port'] = 143;

// IMAP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or null to use
// best server supported one)
//$config['imap_auth_type'] = 'CRAM-MD5';
$config['imap_auth_type'] = null;


//php 5.6 requires this to be setup (SSL changes in PHP 5.6: http://php.net/manual/en/migration56.openssl.php)-
//2015-07-27 had to add/enable these SSL settings in order to get roundcube to actually connect to IMAP over SSL/TLS
$config['imap_conn_options'] = array(
	'ssl' => array(
		  'verify_peer'       => false,
		  'verify_peer_name'  => true,
          'peer_name'		  => 'mydomain.com',
		  'cafile'            => 'C:\Program Files\Apache Software Foundation\Apache24\conf\ssl\letsencrypt\mydomain.com\fullchain.cer',     /// <---This seems to work with letsEncrypt w/'verify_peer'=> false,
          //'local_cert' 	      => 'C:\Program Files\Apache Software Foundation\Apache24\conf\ssl\mydomain_com.crt', # Should be a combined cert & key in pem format

    ),
);

// IMAP connection timeout, in seconds. Default: 0 (use default_socket_timeout)
$config['imap_timeout'] = 0;

// Optional IMAP authentication identifier to be used as authorization proxy
$config['imap_auth_cid'] = null;

// Optional IMAP authentication password to be used for imap_auth_cid
$config['imap_auth_pw'] = null;

// If you know your imap's folder delimiter, you can specify it here.
// Otherwise it will be determined automatically
$config['imap_delimiter'] = null;

// If IMAP server doesn't support NAMESPACE extension, but you're
// using shared folders or personal root folder is non-empty, you'll need to
// set these options. All can be strings or arrays of strings.
// Folders need to be ended with directory separator, e.g. "INBOX."
// (special directory "~" is an exception to this rule)
// These can be used also to overwrite server's namespaces
$config['imap_ns_personal'] = null;
$config['imap_ns_other']    = null;
$config['imap_ns_shared']   = null;

// By default IMAP capabilities are readed after connection to IMAP server
// In some cases, e.g. when using IMAP proxy, there's a need to refresh the list
// after login. Set to True if you've got this case.
$config['imap_force_caps'] = false;

// By default list of subscribed folders is determined using LIST-EXTENDED
// extension if available. Some servers (dovecot 1.x) returns wrong results
// for shared namespaces in this case. http://trac.roundcube.net/ticket/1486225
// Enable this option to force LSUB command usage instead.
// Deprecated: Use imap_disabled_caps = array('LIST-EXTENDED')
$config['imap_force_lsub'] = false;

// Some server configurations (e.g. Courier) doesn't list folders in all namespaces
// Enable this option to force listing of folders in all namespaces
$config['imap_force_ns'] = false;

// List of disabled imap extensions.
// Use if your IMAP server has broken implementation of some feature
// and you can't remove it from CAPABILITY string on server-side.
// For example UW-IMAP server has broken ESEARCH.
// Note: Because the list is cached, re-login is required after change.
$config['imap_disabled_caps'] = array();

// Log IMAP session identifers after each IMAP login.
// This is used to relate IMAP session with Roundcube user sessions
$config['imap_log_session'] = false;

// Type of IMAP indexes cache. Supported values: 'db', 'apc' and 'memcache'.
//$config['imap_cache'] = null;
//2016-10-10 enable memcache for my domaion
$config['imap_cache'] = 'memcache';
$config['session_storage'] = 'memcache';


	
// Enables messages cache. Only 'db' cache is supported.
// This requires an IMAP server that supports QRESYNC and CONDSTORE
// extensions (RFC7162). See synchronize() in program/lib/Roundcube/rcube_imap_cache.php
// for further info, or if you experience syncing problems.
//$config['messages_cache'] = false;
$config['messages_cache'] = 'db';

// Lifetime of IMAP indexes cache. Possible units: s, m, h, d, w
//$config['imap_cache_ttl'] = '10d';
//2018-08-29 updated to value below
//$config['imap_cache_ttl'] = '21d';
$config['imap_cache_ttl'] = '3d';

// Lifetime of messages cache. Possible units: s, m, h, d, w
//$config['messages_cache_ttl'] = '10d';
//2018-08-29 updated to value below
//$config['messages_cache_ttl'] = '21d';
//2018-12-21 updated to value below (Think lower # days to cache may end up being faster per note here:
// https://docs.kolab.org/administrator-guide/roundcube-settings-reference.html#admin-roundcube-settings-messages-cache
// A rule of thumb for establishing the appropriate TTL for the messages cache would be to cache 2 times a single mail_pagesize for any one mail folder (using the default, that would amount to 80 messages
//$config['messages_cache_ttl'] = '3d';
//2020-01-17 updated to value below
$config['messages_cache_ttl'] = '30d';

// Maximum cached message size in kilobytes.
// Note: On MySQL this should be less than (max_allowed_packet - 30%)
//$config['messages_cache_threshold'] = 50;
//$config['messages_cache_threshold'] = 1024;
//2018-08-29 updated to value below based on MySQL setting of max_allowed_packet=16,777,216 bytes (and used 75% of that value)
//$config['messages_cache_threshold'] = 12582;
//2018-10-24 - reduced cached msg size to perhaps fix slow loading issue...
$config['messages_cache_threshold'] = 1024;

//--------------------------------------------------------------------
//----- END MAIN IMAP SECTION ----------------------------------------
//--------------------------------------------------------------------


// ----------------------------------
// CACHE(S)
// ----------------------------------

// Use these hosts for accessing memcached
// Define any number of hosts in the form of hostname:port or unix:///path/to/socket.file
//$config['memcache_hosts'] = null; // e.g. array( 'localhost:11211', '192.168.1.12:11211', 'unix:///var/tmp/memcached.sock' );
$config['memcache_hosts'] = Array(
        //'mydomain.com'
		'localhost:11211'
    );

// Controls the use of a persistent connections to memcache servers
// See http://php.net/manual/en/memcache.addserver.php
$config['memcache_pconnect'] = true;

// Value in seconds which will be used for connecting to the daemon
// See http://php.net/manual/en/memcache.addserver.php
$config['memcache_timeout'] = 1;

// Controls how often a failed server will be retried (value in seconds).
// Setting this parameter to -1 disables automatic retry.
// See http://php.net/manual/en/memcache.addserver.php
$config['memcache_retry_interval'] = 15;

// use these hosts for accessing Redis.
// Currently only one host is supported. cluster support may come in a future release.
// You can pass 4 fields, host, port, database and password.
// Unset fields will be set to the default values host=127.0.0.1, port=6379, database=0, password=  (empty)
$config['redis_hosts'] = null; // e.g. array( 'localhost:6379' );  array( '192.168.1.1:6379:1:secret' );

// Maximum size of an object in memcache (in bytes). Default: 2MB
$config['memcache_max_allowed_packet'] = '2M';

// Maximum size of an object in APC cache (in bytes). Default: 2MB
$config['apc_max_allowed_packet'] = '2M';
	
	
	



// SMTP server host (for sending mails).
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// If left blank, the PHP mail() function is used
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
$config['smtp_server'] = 'tls://localhost';

// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))
//$config['smtp_port'] = 25; //Direct to Mailenable
$config['smtp_port'] = 125;  //Routing through ASSP for spam tracking & maintenance

// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = '%p';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
$config['smtp_auth_type'] = '';

// SMTP socket context options
// See http://php.net/manual/en/context.ssl.php
// The example below enables server certificate validation, and
// requires 'smtp_timeout' to be non zero.
// $config['smtp_conn_options'] = array(

//php 5.6 requires this to be setup (SSL changes in PHP 5.6: http://php.net/manual/en/migration56.openssl.php)-
//2015-07-27 had to add/enable these SSL settings in order to get roundcube to actually connect to IMAP over SSL/TLS
$config['smtp_conn_options'] = array(
	'ssl' => array(
		  'verify_peer'       => false,
		  'verify_peer_name'  => true,
          'peer_name'		  => 'mydomain.com',
		  'cafile'            => 'C:\Program Files\Apache Software Foundation\Apache24\conf\ssl\letsencrypt\mydomain.com\fullchain.cer',     /// <---This seems to work with letsEncrypt w/'verify_peer'=> false,
          //'local_cert' 	      => 'C:\Program Files\Apache Software Foundation\Apache24\conf\ssl\mydomain_com.crt', # Should be a combined cert & key in pem format		  
    ),
);



// provide an URL where a user can get support for this Roundcube installation
// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
$config['support_url'] = '';

// Name your service. This is displayed on the login screen and in the window title
$config['product_name'] = 'Roundcube Webmail';

// this key is used to encrypt the users imap password which is stored
// in the session record (and the client cookie if remember password is enabled).
// please provide a string of exactly 24 chars.
// YOUR KEY MUST BE DIFFERENT THAN THE SAMPLE VALUE FOR SECURITY REASONS
$config['des_key'] = '[[[-REDACTED-]]]';

// List of active plugins (in plugins/ directory)
$config['plugins'] = array(
	'archive',
	'zipdownload',
	'debug_logger',
	'twofactor_gauthenticator',
	'google_addressbook',
	'newmail_notifier',
	'show_additional_headers',
	'removeattachments',
);

////////////////////////////////////////////////////////////////
// Filters plugin settings
// 2016-09-14 //////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
$config['autoAddSpamFilterRule'] = TRUE;  // if TRUE a spam filter rule is created for all users which automatically move messages into junk folder  
$config['spam_subject'] = '[SPAM]';       // How to mark the spam in the subject? To have effect the previous variable must be TRUE.
$config['caseInsensitiveSearch'] = TRUE;  // if TRUE filters searching in case insensitive mode.
$config['decodeBase64Msg'] = TRUE;        // if TRUE decodes base64 mail messages.
////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////
// Attachments setting (fix truncated and weird handling of file names with spaces/special chars/etc.
// 2018-12-18 //////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//0 - Full RFC 2231 compatible 
//1 - RFC 2047 for ‘name’ and RFC 2231 for ‘filename’ parameter (Thunderbird’s default) 
//2 - Full 2047 compatible

//0 = 'Full RFC 2231 (Roundcube, Thunderbird)'
//1 = 'RFC 2047/2231 (MS Outlook, OE)'
//2 = 'Full RFC 2047 (deprecated)'

$config['mime_param_folding'] = 1;  
////////////////////////////////////////////////////////////////
$config['show_additional_headers'] = array('X-Envelope-Sender','X-Original-Authentication-Results','Reply-To','x-priority');


// Absolute path to a local mime.types mapping table file.
// This is used to derive mime-types from the filename extension or vice versa.
// Such a file is usually part of the apache webserver. If you don't find a file named mime.types on your system,
// download it from http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
//$config['mime_types'] = null;
//$config['mime_types'] = 'C:\Program Files\Apache Software Foundation\Apache24\conf\mime.types';
$config['mime_types'] = 'C:\\Program Files\\Apache Software Foundation\\Apache24\\conf\\mime.types';

// skin name: folder from skins/
//$config['skin'] = 'larry';
//$config['skin'] = 'classic';
$config['skin'] = 'litecube-f';



//$config['enable_installer'] = true;
$config['enable_installer'] = false;

 
// use this folder to store log files
// must be writeable for the user who runs PHP process (Apache user if mod_php is being used)
// This is used by the 'file' log driver.
$config['log_dir'] = 'D:\\InetPub\\wwwroot\\mydomain_com\\roundcubemail\\logs\\';


//2014-12-08 disabled this option (hoping to increase speed of app)
// Log session authentication errors to <log_dir>/session or to syslog
$config['log_session'] = false;
// 2019-09-20 (RoundCube 1.4rc2 changelog: Renamed 'log_session' option to 'session_debug'
//$config['session_debug'] = true;

///////////////////// TURN ON DEBUGGIN VIA THIS SECTION //////////////////////
// ----------------------------------
// LOGGING/DEBUGGING
// ----------------------------------

// system error reporting, sum of: 1 = log (low); 4 = show (verbose)
//2019-09-20 - when upgrading to v1.4rc2, installer said this item was an "obsolete or inexistent properties "
$config['debug_level'] = 1;
// ---> set debug_level=4 to get output for logging
//$config['debug_level'] = 4;

// log driver:  'syslog', 'stdout' or 'file'.
$config['log_driver'] = 'file';

// date format for log entries
// (read http://php.net/manual/en/function.date.php for all format characters)  
$config['log_date_format'] = 'd-M-Y H:i:s O';

// length of the session ID to prepend each log line with
// set to 0 to avoid session IDs being logged.
$config['log_session_id'] = 8;

// Syslog ident string to use, if using the 'syslog' log driver.
$config['syslog_id'] = 'roundcube';

// Syslog facility to use, if using the 'syslog' log driver.
// For possible values see installer or http://php.net/manual/en/function.openlog.php
$config['syslog_facility'] = LOG_USER;

// Activate this option if logs should be written to per-user directories.
// Data will only be logged if a directory <log_dir>/<username>/ exists and is writable.
$config['per_user_logging'] = false;

// Log sent messages to <log_dir>/sendmail or to syslog
$config['smtp_log'] = false;

// Log successful/failed logins to <log_dir>/userlogins or to syslog
$config['log_logins'] = false;

// Log session authentication errors to <log_dir>/session or to syslog
$config['log_session'] = false;

// Log SQL queries to <log_dir>/sql or to syslog
$config['sql_debug'] = false;

// Log IMAP conversation to <log_dir>/imap or to syslog
$config['imap_debug'] = false;

// Log LDAP conversation to <log_dir>/ldap or to syslog
$config['ldap_debug'] = false;

// Log SMTP conversation to <log_dir>/smtp or to syslog
$config['smtp_debug'] = false;

// Log Memcache conversation to <log_dir>/memcache or to syslog
$config['memcache_debug'] = false;

// Log APC conversation to <log_dir>/apc or to syslog
$config['apc_debug'] = false;


//////////////////////////////////////////////////////////////////////////////

//2016-10-09 08:50 PM - enable HTTPS force setting to redirect insecure connections to HTTPS
$config['force_https'] = true;


//2014-12-03 added these settings to help performance
//$config['messages_cache'] = false;
//$config['imap_cache'] = 'db';