MCPcopy Index your code
hub / github.com/CapSoftware/Cap / sendEmail

Function sendEmail

packages/database/emails/config.ts:8–52  ·  view source on GitHub ↗
({
	email,
	subject,
	react,
	marketing,
	test,
	scheduledAt,
	cc,
	replyTo,
	fromOverride,
}: {
	email: string;
	subject: string;
	react: ReactElement<unknown, string | JSXElementConstructor<unknown>>;
	marketing?: boolean;
	test?: boolean;
	scheduledAt?: string;
	cc?: string | string[];
	replyTo?: string;
	fromOverride?: string;
})

Source from the content-addressed store, hash-verified

6 serverEnv().RESEND_API_KEY ? new Resend(serverEnv().RESEND_API_KEY) : null;
7
8export const sendEmail = async ({
9 email,
10 subject,
11 react,
12 marketing,
13 test,
14 scheduledAt,
15 cc,
16 replyTo,
17 fromOverride,
18}: {
19 email: string;
20 subject: string;
21 react: ReactElement<unknown, string | JSXElementConstructor<unknown>>;
22 marketing?: boolean;
23 test?: boolean;
24 scheduledAt?: string;
25 cc?: string | string[];
26 replyTo?: string;
27 fromOverride?: string;
28}) => {
29 const r = resend();
30 if (!r) {
31 return Promise.resolve();
32 }
33
34 if (marketing && !buildEnv.NEXT_PUBLIC_IS_CAP) return;
35 let from: string;
36
37 if (fromOverride) from = fromOverride;
38 else if (marketing) from = "Richie from Cap <richie@send.cap.so>";
39 else if (buildEnv.NEXT_PUBLIC_IS_CAP)
40 from = "Cap Auth <no-reply@auth.cap.so>";
41 else from = `auth@${serverEnv().RESEND_FROM_DOMAIN}`;
42
43 return r.emails.send({
44 from,
45 to: test ? "delivered@resend.dev" : email,
46 subject,
47 react,
48 scheduledAt,
49 cc: test ? undefined : cc,
50 replyTo: replyTo,
51 });
52};

Callers 9

sendVerificationRequestFunction · 0.90
sendDownloadLinkFunction · 0.90
sendOrganizationInvitesFunction · 0.90
sendNewCommentEmailFunction · 0.90
sendFirstViewEmailFunction · 0.90
video.tsFile · 0.90
root.tsFile · 0.90
sendMobileEmailCodeFunction · 0.90

Calls 3

serverEnvFunction · 0.90
resendFunction · 0.85
sendMethod · 0.45

Tested by

no test coverage detected