mail: send fully qualified catch all
This commit is contained in:
+16
-8
@@ -72,7 +72,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
submit: function () {
|
||||
$scope.catchall.busy = true;
|
||||
|
||||
var addresses = $scope.catchall.mailboxes.map(function (m) { return m.name; });
|
||||
var addresses = $scope.catchall.mailboxes.map(function (m) { return m.name + '@' + m.domain; });
|
||||
|
||||
Client.setCatchallAddresses($scope.domain.domain, addresses, function (error) {
|
||||
if (error) console.error('Unable to add catchall address.', error);
|
||||
@@ -82,14 +82,23 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
Client.listMailboxes($scope.domain.domain, '', 1, 1000, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
var allMailboxes = [];
|
||||
async.eachSeries($scope.incomingDomains, function (domain, iteratorDone) {
|
||||
Client.listMailboxes(domain.domain, '', 1, 1000, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.catchall.availableMailboxes = result;
|
||||
result.forEach(function (r) { r.display = r.name + '@' + r.domain; });
|
||||
|
||||
$scope.catchall.mailboxes = $scope.domain.mailConfig.catchAll.map(function (name) {
|
||||
return $scope.catchall.availableMailboxes.find(function (m) { return m.name === name; });
|
||||
}).filter(function (m) { return !!m; });
|
||||
allMailboxes = allMailboxes.concat(result);
|
||||
iteratorDone();
|
||||
});
|
||||
}, function () {
|
||||
$scope.catchall.availableMailboxes = allMailboxes;
|
||||
|
||||
$scope.catchall.mailboxes = $scope.domain.mailConfig.catchAll.map(function (address) {
|
||||
const parts = address.split('@');
|
||||
return $scope.catchall.availableMailboxes.find(function (m) { return m.name === parts[0] && m.domain === parts[1]; });
|
||||
}).filter(function (m) { return !!m; }); // remove not found addresses
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -567,7 +576,6 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
error: null,
|
||||
name: '',
|
||||
owner: null,
|
||||
incomingDomains: [],
|
||||
aliases: [],
|
||||
aliasesOriginal: [],
|
||||
active: true,
|
||||
|
||||
Reference in New Issue
Block a user