Email has become an integral part of both our lives, and preserving these communications is crucial. My journey to effectively backup emails began with exploring the best methods and tools available to ensure that my email archives are both searchable and well-organized.
Choosing the Right Format
When it comes to storing emails, there are a couple of common formats: mbox and EML. The mbox format consolidates all emails into a single file, whereas EML files store each email individually. For enhanced searchability, I preferred the individual EML files, despite the potential for creating a large number of files. To manage this, I opted for a structured folder hierarchy: year -> month -> day.
Google Mail Backup with Got-Your-Back
My primary email service is Google Mail, so I started by finding a solution for backing up Gmail. I discovered Got-Your-Back (GYB), an excellent tool that met all my requirements. GYB produces backups in the exact format and structure I needed and supports querying recent changes for quick delta updates. This tool was seamlessly integrated into a daily cron job, ensuring that my Gmail backup is always up-to-date. The setup has been running flawlessly.
You can check out GYB here: Got-Your-Back on GitHub.
Tackling Microsoft 365 Challenges
Backing up emails from Microsoft 365 proved to be more challenging. The default export option in Outlook for macOS is the proprietary OLM format, which isn’t ideal for my needs. However, by switching to Legacy Outlook, I discovered two additional export options: dragging an entire folder to Finder to create an mbox file or dragging individual emails to save them as EML files.
Converting mbox to EML for Outlook emails was problematic due to non-standard headers in the export. Therefore, I resorted to manually selecting all emails and dragging them to a folder in Finder, resulting in individual EML files. While this solution is effective, it cannot be automated and is reserved for periodic manual backups.
Organizing the Emails
To maintain the structured folder hierarchy, I wrote a script to parse and organize the emails. This script moves the emails into the appropriate year -> month -> day folders based on the email headers, updates the modified time to match the email date, and safely handles email subjects for filenames, ensuring proper UTF-8 decoding and uniqueness.
You can find the script here: Email Parsing Script on Gist.
Conclusion
Through a combination of automated and manual methods, I have created a reliable system for preserving my emails. The Google Mail backup runs seamlessly daily, while the Microsoft 365 emails are periodically backed up manually. Both sets of emails are stored in an organized, searchable format, ensuring that I can always access and retrieve my email communications when needed.
Preserving emails may be a challenging task, but with the right tools and strategies, it becomes manageable. Whether you’re dealing with personal or professional emails, having a robust backup system in place provides peace of mind and ensures that your valuable communications are never lost.
0 Comments