+ Configure how and when you receive alerts about your services and infrastructure. +
+Level: ${payload.level}
+${payload.message.replace(/\n/g, '
')}
${JSON.stringify(payload.data, null, 2)}` : ''}
+ `;
+
+ const info = await transporter.sendMail({
+ from: config.from,
+ to: Array.isArray(config.to) ? config.to.join(', ') : config.to,
+ // to: config.from,
+ subject: `[${payload.level.toUpperCase()}] ${payload.title}`,
+ html,
+ // subject: "Portabase",
+ // html: await render(TestEmailSettings(), {}),
+ });
+
+ console.log(info);
+
+ return {
+ success: true,
+ provider: 'smtp',
+ message: `Email sent: ${info.messageId}`,
+ response: info,
+ };
+}
\ No newline at end of file
diff --git a/src/features/notifications/types.ts b/src/features/notifications/types.ts
new file mode 100644
index 00000000..162a366d
--- /dev/null
+++ b/src/features/notifications/types.ts
@@ -0,0 +1,19 @@
+// export type ProviderKind = 'slack' | 'smtp';
+export type ProviderKind = 'smtp';
+
+export interface DispatchResult {
+ success: boolean;
+ channelId?: string;
+ provider: ProviderKind;
+ message?: string;
+ error?: string;
+ response?: any;
+}
+
+export interface EventPayload {
+ title: string;
+ message: string;
+ level: 'critical' | 'warning' | 'info';
+ timestamp?: Date;
+ data?: Record