MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / parseRawEmail

Function parseRawEmail

services/kiloclaw-inbound-email/src/parser.ts:61–70  ·  view source on GitHub ↗
(raw: RawEmail)

Source from the content-addressed store, hash-verified

59}
60
61export async function parseRawEmail(raw: RawEmail): Promise<ParsedInboundEmail> {
62 const email = await PostalMime.parse(raw);
63
64 return {
65 messageId: email.messageId?.trim() ?? null,
66 from: firstAddress(email.from),
67 subject: email.subject ?? '',
68 text: normalizeText(email.text, email.html),
69 };
70}
71
72function rawBytes(raw: string | ArrayBuffer | Uint8Array): Uint8Array {
73 if (typeof raw === 'string') return new TextEncoder().encode(raw);

Callers 2

buildQueueMessageFunction · 0.90
parser.test.tsFile · 0.90

Calls 2

firstAddressFunction · 0.85
normalizeTextFunction · 0.70

Tested by

no test coverage detected