make recvmail work
unlike sendmail, recvmail is always optional. this is the case because the cloudron may not receive emails at all, so app always has to be prepared for it. part of #804
This commit is contained in:
+8
-6
@@ -1063,7 +1063,9 @@ async function setupRecvMail(app, options) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
|
||||
debug('Setting up recvmail');
|
||||
debug('setupRecvMail: setting up recvmail');
|
||||
|
||||
if (!app.enableInbox) return await addonConfigs.set(app.id, 'recvmail', []);
|
||||
|
||||
const existingPassword = await addonConfigs.getByName(app.id, 'recvmail', '%MAIL_IMAP_PASSWORD');
|
||||
|
||||
@@ -1074,13 +1076,13 @@ async function setupRecvMail(app, options) {
|
||||
const env = [
|
||||
{ name: `${envPrefix}MAIL_IMAP_SERVER`, value: 'mail' },
|
||||
{ name: `${envPrefix}MAIL_IMAP_PORT`, value: '9993' },
|
||||
{ name: `${envPrefix}MAIL_IMAP_USERNAME`, value: app.mailboxName + '@' + app.mailboxDomain },
|
||||
{ name: `${envPrefix}MAIL_IMAP_USERNAME`, value: app.inboxName + '@' + app.inboxDomain },
|
||||
{ name: `${envPrefix}MAIL_IMAP_PASSWORD`, value: password },
|
||||
{ name: `${envPrefix}MAIL_TO`, value: app.mailboxName + '@' + app.mailboxDomain },
|
||||
{ name: `${envPrefix}MAIL_DOMAIN`, value: app.mailboxDomain }
|
||||
{ name: `${envPrefix}MAIL_TO`, value: app.inboxName + '@' + app.inboxDomain },
|
||||
{ name: `${envPrefix}MAIL_TO_DOMAIN`, value: app.inboxDomain },
|
||||
];
|
||||
|
||||
debug('Setting sendmail addon config to %j', env);
|
||||
debug('setupRecvMail: setting recvmail addon config to %j', env);
|
||||
await addonConfigs.set(app.id, 'recvmail', env);
|
||||
}
|
||||
|
||||
@@ -1088,7 +1090,7 @@ async function teardownRecvMail(app, options) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
|
||||
debug('Tearing down recvmail');
|
||||
debug('teardownRecvMail: tearing down recvmail');
|
||||
|
||||
await addonConfigs.unset(app.id, 'recvmail');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user