diff --git a/src/platform.js b/src/platform.js index 8a3d26272..684499ae2 100644 --- a/src/platform.js +++ b/src/platform.js @@ -263,12 +263,11 @@ function createMailConfig(callback) { const enabled = relay.provider !== 'cloudron-smtp' ? true : false, host = relay.host || '', port = relay.port || 25, - tls = !!relay.tls, // Whether to connect with TLS (not STARTTLS) username = relay.username || '', password = relay.password || ''; if (!safe.fs.writeFileSync(paths.ADDON_CONFIG_DIR + '/mail/smtp_forward.ini', - `enable_outbound=${enabled}\nhost=${host}\nport=${port}\nenable_tls=${tls}\nauth_user=${username}\nauth_pass=${password}`, 'utf8')) { + `enable_outbound=${enabled}\nhost=${host}\nport=${port}\nenable_tls=true\nauth_type=plain\nauth_user=${username}\nauth_pass=${password}`, 'utf8')) { return callback(new Error('Could not create mail var file:' + safe.error.message)); } diff --git a/src/routes/settings.js b/src/routes/settings.js index 5b28b1cb0..597e25202 100644 --- a/src/routes/settings.js +++ b/src/routes/settings.js @@ -146,7 +146,6 @@ function setMailRelay(req, res, next) { if (typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider is required')); if ('host' in req.body && typeof req.body.host !== 'string') return next(new HttpError(400, 'host must be a string')); if ('port' in req.body && typeof req.body.port !== 'number') return next(new HttpError(400, 'port must be a string')); - if ('tls' in req.body && typeof req.body.tls !== 'boolean') return next(new HttpError(400, 'tls must be a boolean')); if ('username' in req.body && typeof req.body.username !== 'string') return next(new HttpError(400, 'username must be a string')); if ('password' in req.body && typeof req.body.password !== 'string') return next(new HttpError(400, 'password must be a string')); diff --git a/webadmin/src/views/email.html b/webadmin/src/views/email.html index 5f3ef7f91..d9043d2d3 100644 --- a/webadmin/src/views/email.html +++ b/webadmin/src/views/email.html @@ -94,18 +94,12 @@
- +
{{ mailRelay.error.port }}
- -
- -
diff --git a/webadmin/src/views/email.js b/webadmin/src/views/email.js index 5679753f7..237286cf7 100644 --- a/webadmin/src/views/email.js +++ b/webadmin/src/views/email.js @@ -105,7 +105,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio $scope.mailRelay.relay.provider = $scope.mailRelay.preset.provider; $scope.mailRelay.relay.host = $scope.mailRelay.preset.host; $scope.mailRelay.relay.port = $scope.mailRelay.preset.port; - $scope.mailRelay.relay.tls = $scope.mailRelay.preset.tls; + $scope.mailRelay.relay.username = ''; + $scope.mailRelay.relay.password = ''; }, // form data to be set on load @@ -114,19 +115,13 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio host: '', port: 25, username: '', - password: '', - tls: true // whether we should connect with TLS. STARTTLS is always supported + password: '' }, submit: function () { $scope.mailRelay.error = null; $scope.mailRelay.busy = true; - if ($scope.mailRelay.relay.provider === 'external-smtp') { - // this is generally the case - $scope.mailRelay.relay.tls = $scope.mailRelay.relay.port === 465; - } - Client.setMailRelay($scope.mailRelay.relay, function (error) { if (error) { $scope.mailRelay.error = error.message;