Skip to main content
Glama
search-solar-specific.js4.61 kB
#!/usr/bin/env node import { FastMailClient } from './src/fastmail-client.js'; import dotenv from 'dotenv'; dotenv.config({ path: '../.env' }); async function searchSolarSpecific() { console.log('☀️ SEARCHING SPECIFICALLY FOR SOLAR PANEL EMAILS\n'); const client = new FastMailClient( process.env.FASTMAIL_API_TOKEN, 'clark@everson.dev', 'clark@clarkeverson.com', 'clarkeverson.com', 'https://api.fastmail.com/jmap/session' ); try { await client.authenticate(); const mailboxes = await client.getMailboxes(); // More specific solar keywords const solarKeywords = [ 'solar', 'photovoltaic', 'pv system', 'solar panel', 'solar installation', 'renewable energy', 'sunpower', 'tesla solar', 'solar city', 'sunrun', 'vivint solar', 'momentum solar', 'freedom solar', 'enphase', 'inverter', 'kilowatt', 'kwh', 'solar roof', 'net metering', 'solar quote', 'solar estimate', 'solar consultant', 'solar energy' ]; const solarEmails = []; let totalSearched = 0; // Search ALL folders thoroughly console.log('🔍 Searching all folders for solar content...\n'); for (const folder of mailboxes) { if (folder.totalEmails === 0) continue; console.log(`📂 ${folder.name} (${folder.totalEmails} emails)...`); let position = 0; while (position < folder.totalEmails) { const emailResult = await client.getEmails(folder.id, 50, position); if (!emailResult?.emails?.length) break; for (const email of emailResult.emails) { totalSearched++; const subject = (email.subject || '').toLowerCase(); const sender = (email.from?.[0]?.email || '').toLowerCase(); const senderName = (email.from?.[0]?.name || '').toLowerCase(); const preview = (email.preview || '').toLowerCase(); // More thorough solar detection const matchedKeywords = solarKeywords.filter(keyword => subject.includes(keyword) || sender.includes(keyword) || senderName.includes(keyword) || preview.includes(keyword) ); if (matchedKeywords.length > 0) { solarEmails.push({ folder: folder.name, date: email.receivedAt, from: email.from?.[0]?.email || 'Unknown', fromName: email.from?.[0]?.name || '', subject: email.subject || 'No subject', preview: email.preview?.substring(0, 200) || '', matchedKeywords: matchedKeywords }); } } position += emailResult.emails.length; // Show progress for large folders if (position % 200 === 0) { process.stdout.write('.'); } } console.log(''); // New line after dots } console.log(`\n☀️ SOLAR SEARCH RESULTS:`); console.log(`📧 Total emails searched: ${totalSearched}`); console.log(`🔆 Solar emails found: ${solarEmails.length}\n`); if (solarEmails.length === 0) { console.log('❌ No solar panel related emails found'); console.log('💡 Possible reasons:'); console.log(' - Solar quotes may have been deleted'); console.log(' - May be in a folder not searched'); console.log(' - May use different terminology'); console.log(' - Could be in deleted/trash folders'); return; } // Sort by date (newest first) solarEmails.sort((a, b) => new Date(b.date) - new Date(a.date)); console.log('📋 SOLAR PANEL EMAILS FOUND:'); console.log('='.repeat(80)); solarEmails.forEach((email, index) => { const date = new Date(email.date).toLocaleDateString(); console.log(`\n${index + 1}. 📅 ${date} | 📂 ${email.folder}`); console.log(` FROM: ${email.fromName ? `${email.fromName} <${email.from}>` : email.from}`); console.log(` SUBJECT: ${email.subject}`); console.log(` MATCHED: ${email.matchedKeywords.join(', ')}`); console.log(` PREVIEW: ${email.preview}`); }); // Show companies found const companies = new Set(solarEmails.map(e => e.from.split('@')[1]?.toLowerCase())); if (companies.size > 0) { console.log('\n🏢 SOLAR COMPANIES/DOMAINS FOUND:'); companies.forEach(domain => console.log(` • ${domain}`)); } } catch (error) { console.log('❌ Error:', error.message); } } searchSolarSpecific().catch(console.error);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gr3enarr0w/fastmail-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server