Skip to content

Commit

Permalink
Fixed issue: Wrong port and TLS description in bounce email/smtp sett…
Browse files Browse the repository at this point in the history
…ings (#1807)
  • Loading branch information
ViliusS committed Mar 26, 2021
1 parent 309c4c2 commit 9c553e3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion application/config/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

$config['emailsmtpuser'] = ''; // SMTP authorisation username - only set this if your server requires authorization - if you set it you HAVE to set a password too
$config['emailsmtppassword'] = ''; // SMTP authorisation password - empty password is not allowed
$config['emailsmtpssl'] = ''; // Set this to 'ssl' or 'tls' to use SSL/TLS for SMTP connection
$config['emailsmtpssl'] = ''; // Set this to 'ssl' to use SSL/TLS or 'tls' to use StartTLS for SMTP connection

$config['emailsmtpdebug'] = 0; // Settings this to 1 activates SMTP debug mode

Expand Down
26 changes: 11 additions & 15 deletions application/controllers/admin/tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,39 +100,35 @@ public function bounceprocessing($iSurveyId)
$hostname = getGlobalSetting('bounceaccounthost');
$username = getGlobalSetting('bounceaccountuser');
$pass = getGlobalSetting('bounceaccountpass');
$hostencryption = strtoupper(getGlobalSetting('bounceencryption'));
$hostencryption = strtolower(getGlobalSetting('bounceencryption'));
} else {
$accounttype = strtoupper($thissurvey['bounceaccounttype']);
$hostname = $thissurvey['bounceaccounthost'];
$username = $thissurvey['bounceaccountuser'];
$pass = $thissurvey['bounceaccountpass'];
$hostencryption = strtoupper($thissurvey['bounceaccountencryption']);
$hostencryption = strtolower($thissurvey['bounceaccountencryption']);
}

@list($hostname, $port) = explode(':', $hostname);

if (empty($port)) {
if ($accounttype == "IMAP") {
switch ($hostencryption) {
case "OFF":
case "off":
case "tls":
$hostname = $hostname . ":143";
break;
case "SSL":
$hostname = $hostname . ":993";
break;
case "TLS":
case "ssl":
$hostname = $hostname . ":993";
break;
}
} else {
switch ($hostencryption) {
case "OFF":
case "off":
case "tls":
$hostname = $hostname . ":110";
break;
case "SSL":
$hostname = $hostname . ":995";
break;
case "TLS":
case "ssl":
$hostname = $hostname . ":995";
break;
}
Expand All @@ -154,13 +150,13 @@ public function bounceprocessing($iSurveyId)

switch ($hostencryption) // novalidate-cert to have personal CA , maybe option.
{
case "OFF":
case "off":
$flags .= "/notls"; // Really Off
break;
case "SSL":
case "ssl":
$flags .= "/ssl/novalidate-cert";
break;
case "TLS":
case "tls":
$flags .= "/tls/novalidate-cert";
break;
}
Expand Down
8 changes: 4 additions & 4 deletions application/views/admin/global_settings/_bounce.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
<div class="">
<?php $this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array(
'name' => 'bounceencryption',
'value'=> getGlobalSetting('bounceencryption') ,
'value'=> strtolower(getGlobalSetting('bounceencryption')),
'selectOptions'=>array(
"off"=>gT("Off",'unescaped'),
"SSL"=>"SSL",
"TLS"=>"TLS"
"off"=>gT("Off (unsafe)",'unescaped'),
"ssl"=>"SSL/TLS",
"tls"=>"StartTLS"
)
));?>
</div>
Expand Down
6 changes: 3 additions & 3 deletions application/views/admin/global_settings/_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
'name' => 'emailsmtpssl',
'value'=> getGlobalSetting('emailsmtpssl') ,
'selectOptions'=>array(
""=>gT("Off",'unescaped'),
"ssl"=>gT("SSL",'unescaped'),
"tls"=>gT("TLS",'unescaped')
""=>gT("Off (unsafe)",'unescaped'),
"ssl"=>gT("SSL/TLS",'unescaped'),
"tls"=>gT("StartTLS",'unescaped')
)
));?>
</div>
Expand Down
8 changes: 4 additions & 4 deletions application/views/admin/token/bounce.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@
<div class="default controls">
<?php $this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array(
'name' => 'bounceaccountencryption',
'value'=> $settings['bounceaccountencryption'] ,
'value'=> strtolower($settings['bounceaccountencryption']),
'selectOptions'=>array(
"Off"=>gT("Off",'unescaped'),
"SSL"=>gT("SSL",'unescaped'),
"TLS"=>gT("TLS",'unescaped')
"off"=>gT("Off (unsafe)",'unescaped'),
"ssl"=>gT("SSL/TLS",'unescaped'),
"tls"=>gT("StartTLS",'unescaped')
)
));?>
</div>
Expand Down

0 comments on commit 9c553e3

Please sign in to comment.