Email Attachment Organizer
Streamline your digital files by organizing email attachments with custom rules.
Organization Summary
No data configured yet. Please go to the Data Configuration tab to set up your organization rules and add attachments.
Configure Your Rules & Attachments
Organization Rules
Add Attachments
No attachments added. Please configure your data.
'; return; } const organizedFiles = {}; const fileTypeCounts = {}; const senderCounts = {}; attachmentItems.forEach(item => { const inputs = item.querySelectorAll('input'); if(inputs.length < 3) return; const fileName = inputs[0].value.trim(); const sender = inputs[1].value.trim(); const subject = inputs[2].value.trim(); if (!fileName) return; // Get file type const fileExtension = fileName.split('.').pop().toLowerCase(); fileTypeCounts[fileExtension] = (fileTypeCounts[fileExtension] || 0) + 1; // Get sender if(sender) { senderCounts[sender] = (senderCounts[sender] || 0) + 1; } // Determine category let category = 'Uncategorized'; if (categoryBy === 'file-type') { category = fileExtension.toUpperCase(); } else if (categoryBy === 'sender' && sender) { category = sender; } else if (categoryBy === 'subject') { // Simple keyword extraction (first word) for demonstration category = subject.split(' ')[0] || 'General'; } // Mock date for folder structure const date = new Date(); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); // Build folder path let path; if (folderStructure === 'category/year/month') { path = `${category}/${year}/${month}`; } else { path = `${year}/${month}/${category}`; } if (!organizedFiles[path]) { organizedFiles[path] = []; } organizedFiles[path].push(fileName); }); // Build HTML output let html = `Total Attachments
${attachmentItems.length}
File Types
${Object.keys(fileTypeCounts).join(', ').toUpperCase() || 'N/A'}
Organized File Structure
`;
const sortedPaths = Object.keys(organizedFiles).sort();
if (sortedPaths.length === 0) {
html += '
`;
});
}
html += '
Could not generate a file structure. Please check your inputs.
'; } else { sortedPaths.forEach(path => { html += `${path}/
-
`;
organizedFiles[path].forEach(file => {
html += `
- ${file} `; }); html += `
