diff --git a/packages/hoppscotch-backend/src/admin/infra.resolver.ts b/packages/hoppscotch-backend/src/admin/infra.resolver.ts index 1c08e9a2f..83bdd6a9c 100644 --- a/packages/hoppscotch-backend/src/admin/infra.resolver.ts +++ b/packages/hoppscotch-backend/src/admin/infra.resolver.ts @@ -292,6 +292,14 @@ export class InfraResolver { return this.infraConfigService.getAllowedAuthProviders(); } + @Query(() => Boolean, { + description: 'Check if the SMTP is enabled or not', + }) + @UseGuards(GqlAuthGuard) + isSMTPEnabled() { + return this.infraConfigService.isSMTPEnabled(); + } + /* Mutations */ @Mutation(() => [InfraConfig], { diff --git a/packages/hoppscotch-backend/src/infra-config/infra-config.service.ts b/packages/hoppscotch-backend/src/infra-config/infra-config.service.ts index 7ed744d47..845c33130 100644 --- a/packages/hoppscotch-backend/src/infra-config/infra-config.service.ts +++ b/packages/hoppscotch-backend/src/infra-config/infra-config.service.ts @@ -316,6 +316,16 @@ export class InfraConfigService implements OnModuleInit { .split(','); } + /** + * Check if SMTP is enabled or not + * @returns boolean + */ + isSMTPEnabled() { + return ( + this.configService.get('INFRA.MAILER_SMTP_ENABLE') === 'true' + ); + } + /** * Reset all the InfraConfigs to their default values (from .env) */