mail: require catch all to be absolute

This commit is contained in:
Girish Ramakrishnan
2022-09-11 11:15:21 +02:00
parent 2a93c703ef
commit 4e75694ac6
5 changed files with 42 additions and 5 deletions

View File

@@ -1042,6 +1042,10 @@ async function setCatchAllAddress(domain, addresses) {
assert.strictEqual(typeof domain, 'string');
assert(Array.isArray(addresses));
for (const address of addresses) {
if (!validator.isEmail(address)) throw new BoxError(BoxError.BAD_FIELD, `Invalid catch all address: ${address}`);
}
await updateDomain(domain, { catchAll: addresses });
safe(restartMail(), { debug }); // have to restart mail container since haraka cannot watch symlinked config files (mail.ini)