Skip to content

Commit

Permalink
feat: implement email bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
tapiarafael committed Aug 26, 2024
1 parent eaf9c8d commit 7122571
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/meteor/app/apps/server/bridges/bridges.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AppApisBridge } from './api';
import { AppCloudBridge } from './cloud';
import { AppCommandsBridge } from './commands';
import { AppDetailChangesBridge } from './details';
import { AppEmailBridge } from './email';
import { AppEnvironmentalVariableBridge } from './environmental';
import { AppHttpBridge } from './http';
import { AppInternalBridge } from './internal';
Expand Down Expand Up @@ -53,6 +54,7 @@ export class RealAppBridges extends AppBridges {
this._moderationBridge = new AppModerationBridge(orch);
this._threadBridge = new AppThreadBridge(orch);
this._roleBridge = new AppRoleBridge(orch);
this._emailBridge = new AppEmailBridge(orch);
}

getCommandBridge() {
Expand Down Expand Up @@ -150,4 +152,8 @@ export class RealAppBridges extends AppBridges {
getRoleBridge() {
return this._roleBridge;
}

getEmailBridge() {
return this._emailBridge;
}
}
16 changes: 16 additions & 0 deletions apps/meteor/app/apps/server/bridges/email.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { IAppServerOrchestrator } from '@rocket.chat/apps';
import { EmailBridge } from '@rocket.chat/apps-engine/server/bridges/EmailBridge';
import type { IEmail } from '@rocket.chat/apps-engine/server/definitions/email';

import * as Mailer from '../../../mailer/server/api';

export class AppEmailBridge extends EmailBridge {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
}

protected async sendEmail(email: IEmail, appId: string): Promise<void> {
this.orch.debugLog(`The app ${appId} is sending an email.`);
await Mailer.send(email);
}
}

0 comments on commit 7122571

Please sign in to comment.