email account: smtp auth mechanism param

This commit is contained in:
yuri
2019-08-30 12:22:01 +03:00
parent 045264d95f
commit f4d1b4a5b8
11 changed files with 49 additions and 12 deletions
+6 -1
View File
@@ -107,7 +107,12 @@ class Sender
if ($params['auth']) {
if (!empty($params['smtpAuthMechanism'])) {
$options['connectionClass'] = $params['smtpAuthMechanism'];
$smtpAuthMechanism = preg_replace("([\.]{2,})", '', $params['smtpAuthMechanism']);
if (in_array($smtpAuthMechanism, ['login', 'crammd5', 'plain'])) {
$options['connectionClass'] = $smtpAuthMechanism;
} else {
$options['connectionClass'] = 'login';
}
} else {
$options['connectionClass'] = 'login';
}
@@ -20,6 +20,7 @@
"smtpPort": "SMTP Port",
"smtpAuth": "SMTP Auth",
"smtpSecurity": "SMTP Security",
"smtpAuthMechanism": "SMTP Auth Mechanism",
"smtpUsername": "SMTP Username",
"smtpPassword": "SMTP Password"
},
@@ -31,6 +32,11 @@
"status": {
"Active": "Active",
"Inactive": "Inactive"
},
"smtpAuthMechanism": {
"plain": "PLAIN",
"login": "LOGIN",
"crammd5": "CRAM-MD5"
}
},
"labels": {
@@ -32,6 +32,7 @@
"smtpPort": "SMTP Port",
"smtpAuth": "SMTP Auth",
"smtpSecurity": "SMTP Security",
"smtpAuthMechanism": "SMTP Auth Mechanism",
"smtpUsername": "SMTP Username",
"smtpPassword": "SMTP Password",
"fromName": "From Name",
@@ -68,6 +69,11 @@
"Direct-Assignment": "Direct-Assignment",
"Round-Robin": "Round-Robin",
"Least-Busy": "Least-Busy"
},
"smtpAuthMechanism": {
"plain": "PLAIN",
"login": "LOGIN",
"crammd5": "CRAM-MD5"
}
},
"labels": {
@@ -45,7 +45,7 @@
[{"name": "useSmtp"}, false],
[{"name": "smtpHost"}, {"name": "smtpPort"}],
[{"name": "smtpAuth"}, {"name": "smtpSecurity"}],
[{"name": "smtpUsername"}, false],
[{"name": "smtpUsername"}, {"name": "smtpAuthMechanism"}],
[{"name": "smtpPassword"}, false],
[
{"name": "smtpTestSend", "customLabel": null, "view": "views/email-account/fields/test-send"}, false
@@ -74,8 +74,9 @@
[{"name": "smtpIsShared"}, {"name": "smtpIsForMassEmail"}],
[{"name": "smtpHost"}, {"name": "smtpPort"}],
[{"name": "smtpAuth"}, {"name": "smtpSecurity"}],
[{"name": "smtpUsername"}, {"name": "fromName"}],
[{"name": "smtpUsername"}, {"name": "smtpAuthMechanism"}],
[{"name": "smtpPassword"}, false],
[{"name": "fromName"}, false],
[
{"name": "smtpTestSend", "customLabel": null, "view": "views/inbound-email/fields/test-send"}, false
]
@@ -96,7 +96,7 @@
},
"smtpAuth": {
"type": "bool",
"default": false
"default": true
},
"smtpSecurity": {
"type": "enum",
@@ -109,6 +109,11 @@
"smtpPassword": {
"type": "password"
},
"smtpAuthMechanism": {
"type": "enum",
"options": ["login", "crammd5", "plain"],
"default": "login"
},
"createdBy": {
"type": "link",
"readOnly": true
@@ -104,7 +104,7 @@
},
"smtpAuth": {
"type": "bool",
"default": false
"default": true
},
"smtpSecurity": {
"type": "enum",
@@ -117,6 +117,11 @@
"smtpPassword": {
"type": "password"
},
"smtpAuthMechanism": {
"type": "enum",
"options": ["login", "crammd5", "plain"],
"default": "login"
},
"createCase": {
"type": "bool",
"tooltip": true
+2 -1
View File
@@ -487,7 +487,7 @@ class EmailAccount extends Record
public function getSmtpParamsFromAccount(\Espo\Entities\EmailAccount $emailAccount)
{
$smtpParams = array();
$smtpParams = [];
$smtpParams['server'] = $emailAccount->get('smtpHost');
if ($smtpParams['server']) {
$smtpParams['port'] = $emailAccount->get('smtpPort');
@@ -496,6 +496,7 @@ class EmailAccount extends Record
if ($emailAccount->get('smtpAuth')) {
$smtpParams['username'] = $emailAccount->get('smtpUsername');
$smtpParams['password'] = $emailAccount->get('smtpPassword');
$smtpParams['smtpAuthMechanism'] = $emailAccount->get('smtpAuthMechanism');
}
if (array_key_exists('password', $smtpParams)) {
$smtpParams['password'] = $this->getCrypt()->decrypt($smtpParams['password']);
+6 -1
View File
@@ -922,7 +922,7 @@ class InboundEmail extends \Espo\Services\Record
public function getSmtpParamsFromAccount(\Espo\Entities\InboundEmail $emailAccount)
{
$smtpParams = array();
$smtpParams = [];
$smtpParams['server'] = $emailAccount->get('smtpHost');
if ($smtpParams['server']) {
$smtpParams['port'] = $emailAccount->get('smtpPort');
@@ -930,6 +930,11 @@ class InboundEmail extends \Espo\Services\Record
$smtpParams['security'] = $emailAccount->get('smtpSecurity');
$smtpParams['username'] = $emailAccount->get('smtpUsername');
$smtpParams['password'] = $emailAccount->get('smtpPassword');
if ($emailAccount->get('smtpAuth')) {
$smtpParams['smtpAuthMechanism'] = $emailAccount->get('smtpAuthMechanism');
}
if ($emailAccount->get('fromName')) {
$smtpParams['fromName'] = $emailAccount->get('fromName');
}
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/email-account/record/detail', 'views/record/detail', function (Dep) {
define('views/email-account/record/detail', 'views/record/detail', function (Dep) {
return Dep.extend({
@@ -132,6 +132,7 @@ Espo.define('views/email-account/record/detail', 'views/record/detail', function
this.hideField('smtpAuth');
this.hideField('smtpUsername');
this.hideField('smtpPassword');
this.hideField('smtpAuthMechanism');
this.hideField('smtpSecurity');
this.hideField('smtpTestSend');
@@ -145,15 +146,15 @@ Espo.define('views/email-account/record/detail', 'views/record/detail', function
if (this.model.get('smtpAuth')) {
this.showField('smtpUsername');
this.showField('smtpPassword');
this.showField('smtpAuthMechanism');
this.setFieldRequired('smtpUsername');
} else {
this.hideField('smtpUsername');
this.hideField('smtpPassword');
this.hideField('smtpAuthMechanism');
this.setFieldNotRequired('smtpUsername');
}
},
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/inbound-email/record/detail', 'views/record/detail', function (Dep) {
define('views/inbound-email/record/detail', 'views/record/detail', function (Dep) {
return Dep.extend({
@@ -36,7 +36,6 @@ Espo.define('views/inbound-email/record/detail', 'views/record/detail', function
this.initSslFieldListening();
},
wasFetched: function () {
if (!this.model.isNew()) {
return !!((this.model.get('fetchData') || {}).lastUID);
@@ -74,6 +73,7 @@ Espo.define('views/inbound-email/record/detail', 'views/record/detail', function
this.hideField('smtpAuth');
this.hideField('smtpUsername');
this.hideField('smtpPassword');
this.hideField('smtpAuthMechanism');
this.hideField('smtpSecurity');
this.hideField('smtpTestSend');
this.hideField('fromName');
@@ -102,10 +102,12 @@ Espo.define('views/inbound-email/record/detail', 'views/record/detail', function
if (this.model.get('smtpAuth')) {
this.showField('smtpUsername');
this.showField('smtpPassword');
this.showField('smtpAuthMechanism');
this.setFieldRequired('smtpUsername');
} else {
this.hideField('smtpUsername');
this.hideField('smtpPassword');
this.hideField('smtpAuthMechanism');
this.setFieldNotRequired('smtpUsername');
}
},