diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts index c91acf8720..fb755d0c09 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts @@ -2486,7 +2486,7 @@ class BaseModelSqlv2 { formView, filteredColumns ); - (await NcPluginMgrv2.emailAdapter())?.mailSend({ + (await NcPluginMgrv2.emailAdapter(false))?.mailSend({ to: emails.join(','), subject: 'NocoDB Form', html: ejs.render(formSubmissionEmailTemplate, { diff --git a/packages/nocodb/src/lib/meta/helpers/NcPluginMgrv2.ts b/packages/nocodb/src/lib/meta/helpers/NcPluginMgrv2.ts index 21e93fb3ed..d236eb8597 100644 --- a/packages/nocodb/src/lib/meta/helpers/NcPluginMgrv2.ts +++ b/packages/nocodb/src/lib/meta/helpers/NcPluginMgrv2.ts @@ -174,6 +174,7 @@ class NcPluginMgrv2 { } public static async emailAdapter( + isUserInvite = true, ncMeta = Noco.ncMeta ): Promise { const pluginData = await ncMeta.metaGet2(null, null, MetaTable.PLUGIN, { @@ -181,7 +182,12 @@ class NcPluginMgrv2 { active: true, }); - if (!pluginData) throw new Error('Plugin not configured / active'); + if (!pluginData) { + // return null to show the invite link in UI + if (isUserInvite) return null; + // for webhooks, throw the error + throw new Error('Plugin not configured / active'); + } const pluginConfig = defaultPlugins.find( (c) => c.title === pluginData.title && c.category === PluginCategory.EMAIL diff --git a/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts b/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts index f3e6dbd2a2..574a517179 100644 --- a/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/lib/meta/helpers/webhookHelpers.ts @@ -302,7 +302,7 @@ export async function invokeWebhook( case 'Email': { const res = await ( - await NcPluginMgrv2.emailAdapter() + await NcPluginMgrv2.emailAdapter(false) )?.mailSend({ to: parseBody(notification?.payload?.to, newData), subject: parseBody(notification?.payload?.subject, newData),