diff --git a/frontend/src/lib/components/details/WebhooksPanel.svelte b/frontend/src/lib/components/details/WebhooksPanel.svelte index 963f70f055..c1722be2fa 100644 --- a/frontend/src/lib/components/details/WebhooksPanel.svelte +++ b/frontend/src/lib/components/details/WebhooksPanel.svelte @@ -44,12 +44,12 @@ } } - let emailDomain: string = "mail." + $page.url.hostname + let emailDomain: string | null = null async function getEmailDomain() { emailDomain = ((await SettingService.getGlobal({ key: 'email_domain' - })) as any) ?? ("mail." + $page.url.hostname) + })) as any) ?? null } getEmailDomain() @@ -393,26 +393,37 @@ done` {/key} -
- {#key args} - {#key requestType} - {#key webhookType} - {#key tokenType} - {#key token} -
- -
+ {#if emailDomain} +
+ {#key args} + {#key requestType} + {#key webhookType} + {#key tokenType} + {#key token} +
+ +
+ {/key} {/key} {/key} {/key} {/key} - {/key} - - To trigger the job by email, send an email to the address above. The job will receive - two arguments: `raw_email` containing the raw email as string, and `parsed_email` - containing the parsed email as an object. - -
+ + To trigger the job by email, send an email to the address above. The job will + receive two arguments: `raw_email` containing the raw email as string, and + `parsed_email` containing the parsed email as an object. + +
+ {:else} +
+ + Ask an instance superadmin to setup the instance for email triggering (docs) and to set the email domain in the instance settings. + +
+ {/if}
{/key} diff --git a/frontend/src/lib/components/instanceSettings.ts b/frontend/src/lib/components/instanceSettings.ts index 5f1d4f765f..b5678b6b1f 100644 --- a/frontend/src/lib/components/instanceSettings.ts +++ b/frontend/src/lib/components/instanceSettings.ts @@ -46,8 +46,7 @@ export const settings: Record = { }, { label: 'Email domain', - description: - 'Domain to display in webhooks for email triggers, default is the webpage domain prefixed by "mail."', + description: 'Domain to display in webhooks for email triggers (should match the MX record)', key: 'email_domain', fieldType: 'text', storage: 'setting',