36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import type { SzPlatformClient } from '../classes.platformclient.js';
|
|
import * as plugins from '../plugins.js';
|
|
|
|
import { logger } from '../logger.js';
|
|
|
|
export class SzEmailConnector {
|
|
public platformClientRef: SzPlatformClient;
|
|
|
|
constructor(platformClientRefArg: SzPlatformClient) {
|
|
this.platformClientRef = platformClientRefArg;
|
|
}
|
|
|
|
public async sendEmail(
|
|
optionsArg: plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail['request']
|
|
) {
|
|
const typedRequest =
|
|
this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.mta.IRequest_SendEmail>(
|
|
'sendEmail'
|
|
);
|
|
const response = await typedRequest.fire(optionsArg);
|
|
|
|
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
|
|
logger.log('info', `sent email with subject ${optionsArg.title} to ${optionsArg.to}
|
|
body:
|
|
${optionsArg.body.split('\n').map(line => ` ${line}`).join('\n')}
|
|
|
|
`);
|
|
}
|
|
|
|
}
|
|
|
|
public async sendNotification(optionsArg: { toArg: string; subject: string; text: string }) {}
|
|
|
|
public async sendActionLink(optionsArg: { toArg: string; subject: string; text: string }) {}
|
|
}
|