Class MailContactCollector
- Namespace
- MailFathom.Application.Contacts.Collection
- Assembly
- MailFathom.Application.dll
Records the people an account corresponds with, out of the mail synchronization has just committed.
public sealed class MailContactCollector
- Inheritance
-
MailContactCollector
- Inherited Members
Remarks
This runs inside the pass that stored the message and owns no worker, timer, or queue: the headers are already read and the transaction has already committed, so what is left is a bounded number of indexed reads and, rarely, one insert. It reaches the mail server for nothing at all, which is what keeps it out of the fetch it runs behind.
Which addresses are considered is decided by the folder the message arrived in. A message in an ordinary
folder is somebody writing to the user, so its author — the From header — is the candidate. A message in the
folder mapped as Sent is the user writing to somebody, so its primary
recipients — the To header — are. Drafts are unsent and say nothing about correspondence; junk and trash say
the opposite of what a book is for. No other header is ever read: Cc and Bcc are the copied recipients
of somebody else's thread, and Sender and Reply-To name where a message was submitted from and where a
reply is to go rather than who the correspondent is.
The two directions are held to different evidence, deliberately. An address that wrote to the user is recorded once it has written MinimumMessagesFromSender times, because one message from a stranger is not correspondence. An address the user wrote to is recorded at once, because the user having addressed somebody is exactly the evidence a count of their messages is standing in for.
What it writes goes into the book of the account it is synchronizing, which is the one book it may write and the one it asks about. A mailbox is one mailbox however many people are assigned it, so a correspondent it picks up is recorded once and every assigned user reads that record; nothing here reaches a user, and there is no user for it to reach — collection runs under this process's own identity and acts for nobody in particular.
An address that account's own book already holds is left alone, without collection ever reading the record. That is the collision rule the issue behind this feature asked for, and it is a refusal rather than a merge. What a user of the mailbox happens to have written down in their own book is not asked about at all: their record wins at the read instead, so the same person is shown once and under the name they chose, and collection stays unable to learn what any user wrote down.
Nothing here logs, and nothing it hands to an instrument names a person. What it reports is which of six conclusions it reached, and the identities involved stay between the message and the book.
Constructors
- MailContactCollector(ContactBook, IContactCollectionSettingsReader, IAuthoredMailTally, IContactCollectionTelemetry)
Initializes collection over the book it writes to and the evidence it reads.
Fields
- MaximumRecipientsCollected
How many primary recipients a message the user sent may name and still be read as correspondence.
Methods
- CollectFromAsync(ExtractedEmailMetadata, ContactCollectionRun, CancellationToken)
Records whoever one committed message says the account corresponds with.
- OpenRun(MailAccountId, MailFolderSpecialUse?)
Opens what one synchronization run of one folder collects under.