snegov 7c8db7999a Treat a known Message-ID as a duplicate in the mail importer
Outlook for Mac rewrites headers on every export, so a re-exported
message never hashes the same twice. Hash-only matching stored each
re-export as a variant beside the original.
2026-10-07 13:04:52 -07:00

Scriptory

Bulk Outlook email import

Export any number of messages from Outlook into ~/Seafile/buffer/mail/. Outlook's subject-based filenames and numeric collision suffixes do not matter; the importer reads each email's headers and content hash.

Import all new messages:

~/Seafile/tower/repo/scriptory/import-outlook-mail.py

The default canonical destination is ~/Seafile/doc/job/Parallels/mail/. Messages are grouped by the year and month of the email's Date header. A normal filename is YYYYMMDD-HHMMSSZ-subject.eml; the timestamp is normalized to UTC when the header includes a timezone. A short SHA-256 suffix is added only if a different message already has the same generated filename. Unknown or invalid dates are stored under unknown-date/.

The importer regenerates index.csv from the archive with the full SHA-256, selected normalized header values, and archive path. Its duplicate rules are:

  • An existing SHA-256 is a duplicate and is skipped.
  • An existing Message-ID is a duplicate and is skipped. Outlook rewrites headers on every export, so the same message rarely hashes the same twice.
  • A message without a Message-ID is checked by SHA-256 only.
  • A repeated subject alone is not a duplicate.

Each new message is copied to a temporary file beside its final destination, SHA-256 verified, and then published without overwriting an existing file. Files in ~/Seafile/buffer/mail/ are never modified or deleted. Clear the buffer manually only after confirming that Seafile has synchronized the canonical archive.

Only .eml files are imported. Other files are reported as unsupported, left untouched, and cause a nonzero exit so they are not missed before the buffer is cleared. To use different directories:

~/Seafile/tower/repo/scriptory/import-outlook-mail.py \
  --source /path/to/export \
  --archive /path/to/archive
S
Description
No description provided
Readme
66 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 90.8%
Shell 9.2%