Skip to content

Commit

Permalink
chore: deprecate from
Browse files Browse the repository at this point in the history
  • Loading branch information
tapiarafael committed Oct 22, 2024
1 parent fd5e54f commit b7d5345
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion apps/meteor/app/apps/server/bridges/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ import type { IEmail } from '@rocket.chat/apps-engine/definition/email';
import { EmailBridge } from '@rocket.chat/apps-engine/server/bridges';

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

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

protected async sendEmail(email: IEmail, appId: string): Promise<void> {
let { from } = email;
if (!from) {
this.orch.debugLog(`The app ${appId} didn't provide a from address, using the default one.`);
from = String(settings.get('From_Email'));
}

this.orch.debugLog(`The app ${appId} is sending an email.`);
await Mailer.send(email);
await Mailer.send({ ...email, from });
}
}
5 changes: 4 additions & 1 deletion packages/apps-engine/src/definition/email/IEmail.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export interface IEmail {
to: string | string[];
from: string;
/**
* @deprecated this will be inferred from the settings
*/
from?: string;
replyTo?: string;
subject: string;
html?: string;
Expand Down

0 comments on commit b7d5345

Please sign in to comment.