Skip to content

Commit 41ff358

Browse files
committed
fix missing html & remove unused func
1 parent f2ab25c commit 41ff358

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

apps/api/src/lib/imap.ts

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,6 @@ const year = date.getFullYear();
1414
//@ts-ignore
1515
const d = new Date([year, month, today]);
1616

17-
function parseEmailContent(emailText: any) {
18-
const lines = emailText.split("\n");
19-
const parsedData = {
20-
name: "",
21-
email: "",
22-
phoneNumbers: [],
23-
addresses: [],
24-
companyDetails: "",
25-
};
26-
27-
let inAddressSection = false;
28-
29-
lines.forEach((line: any) => {
30-
if (line.includes("@")) {
31-
parsedData.email = line.trim();
32-
} else if (line.includes("US:") || line.includes("UK:")) {
33-
//@ts-ignore
34-
parsedData.phoneNumbers.push(line.trim());
35-
} else if (line.includes("ISO")) {
36-
parsedData.companyDetails = line.trim();
37-
} else if (line.trim() === "North America:" || line.trim() === "Europe:") {
38-
inAddressSection = true;
39-
//@ts-ignore
40-
} else if (inAddressSection && line.trim() !== "") {
41-
//@ts-ignore
42-
parsedData.addresses.push(line.trim());
43-
}
44-
});
45-
46-
return parsedData;
47-
}
48-
4917
export const getEmails = async () => {
5018
try {
5119
const queues = await client.emailQueue.findMany({});
@@ -87,7 +55,7 @@ export const getEmails = async () => {
8755

8856
console.log("from", from);
8957

90-
const parsedData = parseEmailContent(textAsHtml);
58+
// const parsedData = parseEmailContent(textAsHtml);
9159

9260
if (subject !== undefined && subject.includes("Re:")) {
9361
return await client.comment.create({
@@ -116,7 +84,7 @@ export const getEmails = async () => {
11684
isComplete: Boolean(false),
11785
priority: "Low",
11886
fromImap: Boolean(true),
119-
detail: html,
87+
detail: html ? html : textAsHtml,
12088
},
12189
});
12290

0 commit comments

Comments
 (0)