email_organization
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
email_organization [2025/03/22 20:49] – created lwattsii | email_organization [2025/03/23 00:47] (current) – lwattsii | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | < | + | ====== |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | body { font-family: | + | |
- | h1, h2 { color: #2a2a2a; } | + | |
- | code { background: #f4f4f4; padding: 2px 6px; border-radius: | + | |
- | ul { margin-top: 0; } | + | |
- | </ | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | [[Archive Update|Archive Update]] |
- | < | + | |
- | < | + | ===== Purpose ===== |
- | <ul> | + | This system automatically searches |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ul> | + | |
- | < | + | ===== What It Does ===== |
- | | + | |
- | < | + | * Converts each email into a timestamped **.pdf** file using Google Apps Script. |
- | < | + | * Stores |
- | < | + | * Filenames follow this format: '' |
- | < | + | |
- | </ol> | + | |
- | < | + | ===== How It Works ===== |
- | | + | |
+ | - Paste the provided script for the desired sender/ | ||
+ | - Run the script and authorize permissions. | ||
+ | - The script auto-creates a Drive folder (if not existing) and fills it with PDFs. | ||
- | <pre>< | + | ===== Script Template ===== |
+ | Replace '' | ||
+ | |||
+ | < | ||
+ | function archiveAllEmailsWithDomain() { | ||
var domain = " | var domain = " | ||
var threads = GmailApp.search(" | var threads = GmailApp.search(" | ||
Line 62: | Line 49: | ||
} | } | ||
} | } | ||
- | }</ | + | } |
+ | </ | ||
+ | |||
+ | ===== Configured Examples ===== | ||
+ | * **Shari Bradix (specific address):** '' | ||
+ | * **All CNA contacts:** '' | ||
+ | * **All J.S. Held engineers: | ||
+ | * **Bockmon Insurance: | ||
+ | |||
+ | ===== Next Steps (Optional) ===== | ||
+ | * Add automatic scheduling to run these scripts daily/weekly. | ||
+ | * Enhance script to export attachments or summarize content with AI. | ||
+ | * Back up Drive folders to external storage/ | ||
+ | |||
+ | ---- | ||
+ | '' | ||
+ | |||
+ | ====== Email Organization Overview ====== | ||
+ | |||
+ | This page documents how our Gmail-to-PDF email archiving system is structured for project organization, | ||
+ | |||
+ | ===== Folder Structure and Categories ===== | ||
+ | |||
+ | * **Gmail PDFs - Shari Bradix (All)** → All emails to/from Shari.Bradix@cna.com | ||
+ | * **Gmail PDFs - CNA (All Emails)** → All emails to/from @cna.com | ||
+ | * **Gmail PDFs - CNA Other than Shari** → All CNA emails excluding Shari.Bradix@cna.com | ||
+ | * **Gmail PDFs - J.S. Held (All Emails)** → All emails to/from @jsheld.com | ||
+ | * **Gmail PDFs - Bockmon Insurance (All Emails)** → All emails to/from @bockmoninsurance.com | ||
+ | * **Gmail PDFs - Marshall Texas (All Emails)** → All emails to/from @marshalltexas.net | ||
+ | * **Gmail PDFs - Eric Powell (Marshall Texas)** → All emails to/from Powell.eric@marshalltexas.net | ||
+ | |||
+ | |||
+ | ===== Notes on Script Execution ===== | ||
+ | |||
+ | Scripts are designed to run one-time only (manually), and generate a PDF of each email retrieved by the Gmail query. All scripts follow the same structure: loop through threads → extract each message → convert to PDF → save in Drive folder. | ||
+ | |||
+ | Each script is mapped to a unique folder name for safe targeting and easy retrieval. | ||
+ | |||
+ | |||
+ | ===== Special Case: Eric Powell Email Filtering ===== | ||
+ | |||
+ | Eric Powell’s original archive script was missing some emails. This was due to Gmail’s `.getTo()` and `.getFrom()` fields sometimes being blank or incomplete in: | ||
+ | |||
+ | * Sent mail | ||
+ | * BCC’d messages | ||
+ | * Threaded replies where Powell was in earlier parts of the conversation | ||
+ | |||
+ | Gmail correctly returned the threads, but the script was skipping emails inside those threads based on this check: | ||
+ | ```javascript | ||
+ | if (!(sender.includes(email) || recipient.includes(email))) { | ||
+ | continue; | ||
+ | } | ||
+ | ``` | ||
+ | |||
+ | **Fix:** | ||
+ | We replaced this logic with a cleaner, dual-check method: | ||
+ | ```javascript | ||
+ | var isFrom = sender.includes(email.toLowerCase()); | ||
+ | var isTo = recipient.includes(email.toLowerCase()); | ||
+ | if (!isFrom && !isTo) continue; | ||
+ | ``` | ||
+ | This ensures that every message **directly involving Powell** is captured — no more skipped BCCs or sent replies. | ||
+ | |||
+ | Other scripts (like domain-based searches for `@cna.com`) are not affected because they cast a wider net and don’t rely on a single recipient match. | ||
+ | |||
+ | |||
+ | ===== Status ===== | ||
+ | |||
+ | All seven archiving scripts are now finalized and verified: | ||
+ | * 🟢 Folder names confirmed | ||
+ | * 🟢 Gmail queries validated | ||
+ | * 🟢 Powell fix implemented only where needed | ||
+ | * 🟢 Manual execution completed with no errors | ||
- | < | + | We are ready to move to the summarization/AI review phase. |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ul> | + | |
- | < | ||
- | <ul> | ||
- | < | ||
- | < | ||
- | < | ||
- | </ul> | ||
- | </ | ||
- | </ | ||
email_organization.1742676543.txt.gz · Last modified: 2025/03/22 20:49 by lwattsii