// test_parser.js // A simple test script to demonstrate how to use the email parser // Import the email parser functions // Note: In a browser context, you would use importScripts instead const { parseMimeEmail, extractEmailThread } = require('./email_parser.js'); // Example MIME email content const mimeContent = `MIME-Version: 1.0 Date: Fri, 2 May 2025 13:40:14 -0700 References: In-Reply-To: Bcc: 45972187@bcc.hubspot.com Message-ID: Subject: Re: Re: Funding marketing agencies From: Curtis Boortz To: kirk@219group.com Cc: Maria Zandonai Content-Type: multipart/alternative; boundary="0000000000005794a106342d2806" --0000000000005794a106342d2806 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Kirk, Here with Maria, just jumping in to support. Yours is a unique case, and this is on us for not making it clear sooner, but the Bolt loan has industry restrictions around marketing agencies, so they aren't the best option here. That said, we work with another SBA bank, Newity, that offers a very similar product; the main difference is that they *can* work with marketing agencies. If that sounds alright with you, I'm happy to move this forward. The next step would be filling out a quick 5-minute application, after which we can get some hard numbers for you. Let me know what you think. Best, Curtis --0000000000005794a106342d2806 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Kirk,

Here with Maria, just jum= ping in to support. Yours is a unique case, and this is on us for not makin= g it clear sooner, but the Bolt loan has industry restrictions around marke= ting agencies, so they aren't the best option here.

That said, w= e work with another=C2=A0SBA bank, Newity, that offers a very similar produ= ct; the main difference is that they can=C2=A0work with marketing ag= encies.=C2=A0

If that sounds alright with you, I'm happy to move= this forward. The next step would be filling out a quick 5-minute applicat= ion, after which we can get some hard numbers for you. Let me know what you= think.

Best,
Curtis

--0000000000005794a106342d2806--`; // Parse the MIME email console.log('Parsing MIME email...'); const parsedEmail = parseMimeEmail(mimeContent); console.log('Parsed email headers:', parsedEmail.headers); console.log('Text content:', parsedEmail.textContent); console.log('HTML content:', parsedEmail.htmlContent); // Extract the email thread console.log('\nExtracting email thread...'); const emailThread = extractEmailThread(mimeContent); console.log('Subject:', emailThread.subject); console.log('From:', emailThread.sender.name, '<' + emailThread.sender.email + '>'); console.log('To:', emailThread.recipient.name, '<' + emailThread.recipient.email + '>'); console.log('Content:', emailThread.content); // Usage in a browser context: /* // In a content script: document.getElementById('parse-button').addEventListener('click', async () => { const mimeContent = document.getElementById('mime-input').value; try { const emailData = await parseMimeEmail(mimeContent); console.log('Parsed email:', emailData); document.getElementById('result').textContent = JSON.stringify(emailData, null, 2); } catch (error) { console.error('Failed to parse email:', error); document.getElementById('result').textContent = 'Error: ' + error.message; } }); // Or using the background script via message passing: document.getElementById('parse-button').addEventListener('click', async () => { const mimeContent = document.getElementById('mime-input').value; chrome.runtime.sendMessage({ action: 'parseMimeEmail', mimeContent }, response => { if (response && response.success) { console.log('Parsed email:', response.emailData); document.getElementById('result').textContent = JSON.stringify(response.emailData, null, 2); } else { console.error('Failed to parse email:', response.error); document.getElementById('result').textContent = 'Error: ' + response.error; } }); }); */