MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / sendTemplateNow

Function sendTemplateNow

apps/api/src/lib/email/email.dispatch.ts:22–52  ·  view source on GitHub ↗
(
  input: ISendTemplateInput
)

Source from the content-addressed store, hash-verified

20 * the address is clean.
21 */
22export const sendTemplateNow = async (
23 input: ISendTemplateInput
24): Promise<ISendOutcome> => {
25 const suppression = await emailSuppressionService.isSuppressed(input.to);
26
27 if (suppression !== null) {
28 logger.info("Skipping email send — recipient is on suppression list", {
29 event: "email_dispatch.suppressed",
30 to: maskEmailForLogging(input.to),
31 templatePath: input.templatePath,
32 reason: suppression.reason,
33 provider: suppression.provider,
34 });
35
36 return { status: "suppressed", reason: suppression.reason };
37 }
38
39 const html = emailTemplateService.render(input.templatePath, {
40 ...baseTemplateVariables(),
41 subject: input.subject,
42 ...input.variables,
43 });
44
45 await emailService.send({
46 to: input.to,
47 subject: input.subject,
48 html,
49 });
50
51 return { status: "sent" };
52};
53
54/**
55 * Dispatch an email through the configured pipeline:

Callers 4

processJobMethod · 0.90
dispatchMethod · 0.90
sendTemplateFunction · 0.85

Calls 6

maskEmailForLoggingFunction · 0.90
baseTemplateVariablesFunction · 0.90
isSuppressedMethod · 0.80
infoMethod · 0.80
renderMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected