Skip to main content

Email Reply Parser

This package contains functions for parsing email reply info like body, content, attendees, and any data related to an email reply.

Contains the following functions in Email Reply Parser File​

Function to replace new lines in a string with <br> tags​

replaceNewLines(replyBody: string): string;

Function to parse and obfuscate emails in a body of text​

function parseEmailsInBody(replyBody: string): string;

Function to generate author text from an author object and date​

function generateAuthorText(author: { display_name: string; email_address: string }, replyDate: string): string;

Function to parse a reply, combining author text and reply body​

function parseReply(body: string, sent_at: string, author: { display_name: string; email_address: string }): string;

Function to parse a subject line, prepending 'Re:' if not present​

function parseSubject(subject: string): string;

Helper function to ensure a header is returned as an array​

function ensureHeaderIsArray(header: string | string[] | null): string[];

Function to remove duplicate email addresses from headers​

function removeDuplicates(headers: string[]): string[];

Function to construct a list of CC headers excluding the user's email​

function constructCCHeaders(headers: { to?: string | string[]; cc?: string | string[] }, userEmail: string): string;

Function to get the intended recipient, either from a given person object or API call​

function getIntendedRecipient(replyObj: { sender_id: number }, originalRecipient: string, person?: object): Promise<{ data: object }>;

function getFooterContent(personId: number): Promise<any>;

Function to determine if 'Reply All' should be shown based on headers and user email​

function showReplyAll(headers: { to?: string | string[]; cc?: string | string[] }, userEmail: string): boolean;