Fix IMAP_FORCE_NORSH and option for imap without ssl

This commit is contained in:
Laurent Destailleur 2021-02-08 19:21:32 +01:00
parent 6e6b5973b8
commit 6df6286688
2 changed files with 10 additions and 4 deletions

View File

@ -415,7 +415,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (function_exists('imap_open'))
{
$connectstringserver = $object->getConnectStringIMAP();
// Note: $object->host has been loaded by the fetch
$usessl = 1;
$connectstringserver = $object->getConnectStringIMAP($usessl);
try {
if ($sourcedir) {

View File

@ -202,7 +202,6 @@ class EmailCollector extends CommonObject
public $debuginfo;
const STATUS_DISABLED = 0;
const STATUS_ENABLED = 1;
@ -716,11 +715,15 @@ class EmailCollector extends CommonObject
// Connect to IMAP
$flags = '/service=imap'; // IMAP
if ($ssl) $flags .= '/ssl'; // '/tls'
if (!empty($conf->global->IMAP_FORCE_TLS)) {
$flags .= '/tls';
} elseif (empty($conf->global->IMAP_FORCE_NOSSL)) {
if ($ssl) $flags .= '/ssl';
}
$flags .= '/novalidate-cert';
//$flags.='/readonly';
//$flags.='/debug';
if ($norsh || !empty($conf->global->IMPA_FORCE_NORSH)) $flags .= '/norsh';
if ($norsh || !empty($conf->global->IMAP_FORCE_NORSH)) $flags .= '/norsh';
$connectstringserver = '{'.$this->host.':993'.$flags.'}';