MCPcopy
hub / github.com/fosrl/pangolin / createEmailClient

Function createEmailClient

server/emails/index.ts:8–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import SMTPTransport from "nodemailer/lib/smtp-transport";
7
8function createEmailClient() {
9 const emailConfig = config.getRawConfig().email;
10 if (!emailConfig) {
11 logger.warn(
12 "Email SMTP configuration is missing. Emails will not be sent."
13 );
14 return;
15 }
16
17 const settings = {
18 host: emailConfig.smtp_host,
19 port: emailConfig.smtp_port,
20 secure: emailConfig.smtp_secure || false,
21 auth:
22 emailConfig.smtp_user && emailConfig.smtp_pass
23 ? {
24 user: emailConfig.smtp_user,
25 pass: emailConfig.smtp_pass
26 }
27 : null
28 } as SMTPTransport.Options;
29
30 if (emailConfig.smtp_tls_reject_unauthorized !== undefined) {
31 settings.tls = {
32 rejectUnauthorized: emailConfig.smtp_tls_reject_unauthorized
33 };
34 }
35
36 return nodemailer.createTransport(settings);
37}
38
39export const emailClient = createEmailClient();
40

Callers 1

index.tsFile · 0.85

Calls 1

getRawConfigMethod · 0.80

Tested by

no test coverage detected