Repository navigation
This release adds selection rules, which let an ingestion source archive only selected mailboxes, folders and tags. It also adds separate Cc and Bcc filters to advanced search, shows the archive time on each email, and corrects several cases where IMAP sources skipped email and where one email stopped the indexing worker.
Highlights
Selection rules
Until now, an ingestion source archived everything it could reach. A source can now be narrowed down with selection rules, which are set under Advanced Options when a source is created or edited, or through the selectionRules field of the API.
- Mailboxes. Google Workspace and Microsoft 365 sources accept lists of mailboxes to include and to exclude. A pattern is compared with the main address of a mailbox and with every alias the directory lists for it.
- Mailbox types. Microsoft 365 sources can skip disabled accounts, shared mailboxes, room mailboxes and equipment mailboxes. Google Workspace sources can skip suspended or archived users, and mailboxes that an administrator has marked as shared on the Seats page. These options only act on what the provider or an administrator states directly. Open Archiver does not guess a type from a mailbox name or a licence.
- Folders. Every provider accepts lists of folders to include and to exclude. For Google Workspace, the patterns are compared with the Gmail labels of each message.
- Tags. Google Workspace and JMAP sources can leave out messages that carry certain tags.
A pattern can be a plain name, a name with the wildcards * and ?, or a regular expression written between two slashes. Regular expressions run on the RE2 engine, so a pattern cannot slow a sync down, and a pattern that RE2 does not support is refused when the source is saved. An exclude pattern always wins over an include pattern.
Rules apply from the next sync onwards and never delete mail that is already in the archive. After each sync, the status message of the source says how many mailboxes were skipped and why.
The selection rules guide describes every option, including how Gmail labels are checked and what happens when rules are changed later. This feature answers the requests in #53, #211 and #331.
Cc and Bcc filters in advanced search
The To (recipient) filter matches an address in To, Cc or Bcc together. Advanced search now has separate Cc and Bcc filters that check only that one field, which makes it possible to find, for example, the emails where a person was only copied. The same filters are available on GET /v1/search as cc and bcc.
These two filters accept exact addresses only. A value that contains * is refused, because the index stores the wildcard parts for To, Cc and Bcc together and cannot tell the fields apart. Mail that is already indexed does not need to be indexed again.
The archive time is shown on each email
The email page showed only when an email was sent. It now also shows when the email was archived, next to the sent time and in the date format chosen in System Settings. The two differ for imported old mail and for mailboxes that synced late, and until now the page gave no way to tell.
Ingestion
- IMAP sources no longer skip mail after a failed fetch. When a message could not be fetched, the sync position of the folder still moved past it, so the message was never archived. After a reconnect, the folder was also not selected again. Failed fetches are now counted, the folder is selected again after a reconnect, and the sync position never moves past mail that has not been archived (#511).
- IMAP sources notice when a server renumbers a folder. Some servers reset the message numbering of a folder, for example after a migration or a restore. Open Archiver kept its old position and skipped new mail that received lower numbers. The folder's
UIDVALIDITYvalue is now stored with the position, and the folder is scanned again when the value changes. Mail that is already in the archive is not archived twice (#525). - PST imports record Cc and Bcc recipients correctly. Every recipient of an email imported from a PST file was written to the To field. The PST library has been updated to a version that reads the recipient type (#498). Emails imported before this version keep the old headers; see the upgrade notes.
- Emails with an empty attachment Content-Type are archived. An attachment header such as
Content-Type: ;made the email fail, and the email was not archived (#509). - Emails can be stored on CIFS and SMB mounts when the file name contains angle brackets. These mounts answer the hard link request with "file not found" for such names. Open Archiver now falls back to a rename in that case (#505).
- Single-tenant Microsoft apps can use the device code sign-in. The Microsoft work or school preset of the OAuth Mailbox provider used the
organizationsendpoint, which Microsoft refuses for a single-tenant app registration with the errorAADSTS50059. The form has a new optional Directory (Tenant) ID field for this case (#503). - Switching an OAuth Mailbox source to the device code flow removes the stored client secret. The form hides the secret for this flow, but an edit kept the stored one, and the token refresh then failed. The secret is now dropped, and the source asks for a new sign-in (#527, #538).
Search and indexing
- One email can no longer hang the indexing worker. A stored email that the parser could not finish kept the worker busy without end, and no other email was indexed. Parsing now runs in a separate thread with a time limit. An email that exceeds the limit counts as a failed indexing attempt, and the worker continues with the next one (#526). The limit is set by the new
INDEXING_PARSE_TIMEOUT_MSvariable. - A busy Meilisearch no longer breaks a batch apart. When Meilisearch answered with status 408 or 429, the batch was split and every document was sent on its own, which added load to a server that was already overloaded. These answers are now retried as a whole batch (#516).
- Indexing progress survives a failed status check. A single failed request for the status of an indexing task failed the whole batch, even though Meilisearch was still working on it. Open Archiver now keeps waiting for the task. Documents that had to be sent one by one are also marked as indexed as each one finishes, not at the end of the batch (#522).
Deployment and operations
- The API and the web interface restart when one of them stops. If either process exited, it stayed down while the container kept running, so Docker did not restart it and every page returned an error until someone restarted the container by hand. Both processes are now restarted after five seconds, in the same way as the workers already were, and their log lines are prefixed with
[api]and[frontend](#530). - New environment variable
INDEXING_PARSE_TIMEOUT_MS. It sets the base time allowed to parse one email for indexing. The default is60000(60 seconds), and 2 seconds are added for every megabyte of the email. The minimum is1000.
Upgrade notes
- Microsoft 365 permission. The options that skip disabled accounts or shared, room and equipment mailboxes need the
MailboxSettings.Readapplication permission, with admin consent, on the app registration. Without it, a source that uses these options holds back the affected mailboxes, shows the Error status and names the missing permission in its status message. Sources that do not use these options are not affected. The Microsoft 365 guide lists the permission. - Microsoft 365 mailbox types are learned step by step. When one of the type options is used, a mailbox is not archived until Exchange has reported its type, and Open Archiver asks about no more than 200 mailboxes per sync. On a large tenant, the first import is therefore spread over several syncs. The status message says how many mailboxes are still waiting.
- Gmail labels are checked once. A Google Workspace message is compared with the rules when it is first archived, and not again when its labels change later. The guide explains which labels work well for this reason.
- PST imports made before this version keep all recipients in the To field. To correct them, delete the source and import the PST file again.
- Single-tenant Microsoft apps. The tenant ID is not stored as a separate value. When the connection settings of such a source are edited later, the tenant ID has to be entered again.
- Interface languages. The new texts for selection rules and for the tenant ID field are available in English only and are shown in English in the other languages. The Cc, Bcc and archive time texts are translated for every language.
Contributors
- @weishest
- Selection rules for mailboxes, folders and tags (#53, #211, #331)
- IMAP sync position after failed fetches and reconnects (#511)
- IMAP folders whose numbering was reset (#525)
- PST Cc and Bcc recipients (#498)
- Tenant ID for single-tenant Microsoft apps in the device code sign-in (#503)
- Attachments with an empty Content-Type (#509)
- Storage on CIFS and SMB mounts (#505)
- Email parsing in a separate thread with a time limit (#526)
- Meilisearch retries and indexing progress (#516, #522)
- @kisst
- @mateuscmtropical
- Client secret removed when a source moves to the device code flow (#538)
Thanks to everyone who reported the issues that shaped this release.
Full Changelog: v0.6.2...v0.7.0