MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / sendMail

Function sendMail

packages/integration-email/src/outbound.ts:90–128  ·  view source on GitHub ↗
({
  event,
  data: { to, from, body, channelInbox, lastExternalMessageId, title },
}: {
  event: string;
  data: {
    from?: string | null;
    to?: string | null;
    body: string;
    channelInbox: string;
    lastExternalMessageId?: string | null;
    title?: string | null;
  };
})

Source from the content-addressed store, hash-verified

88}
89
90async function sendMail({
91 event,
92 data: { to, from, body, channelInbox, lastExternalMessageId, title },
93}: {
94 event: string;
95 data: {
96 from?: string | null;
97 to?: string | null;
98 body: string;
99 channelInbox: string;
100 lastExternalMessageId?: string | null;
101 title?: string | null;
102 };
103}) {
104 const transporter = nodemailer.createTransport({
105 host: process.env.EMAIL_BRIDGE_HOST!,
106 port: 465,
107 secure: true,
108 auth: {
109 user: process.env.EMAIL_BRIDGE_USER!,
110 pass: process.env.EMAIL_BRIDGE_PASS!,
111 },
112 });
113
114 if (!to) {
115 return '"to" not found';
116 }
117 const sendResponse = await transporter.sendMail({
118 ...(lastExternalMessageId && {
119 inReplyTo: lastExternalMessageId,
120 }),
121 from: from ? `${from} ${channelInbox}` : channelInbox,
122 to: extractEmail(to)?.join(),
123 text: body,
124 subject: `Re: ${title}`,
125 });
126 console.log(stringify(sendResponse));
127 return parseResponse(sendResponse.response);
128}

Callers 1

processNewMessageFunction · 0.85

Calls 4

extractEmailFunction · 0.90
parseResponseFunction · 0.90
stringifyFunction · 0.85
logMethod · 0.65

Tested by

no test coverage detected