Table of Contents

Struct MailRuleFact

Namespace
MailFathom.Application.Rules.Facts
Assembly
MailFathom.Application.dll

Identifies one thing a rule condition may read about an email, together with the shape of value it carries.

[JsonConverter(typeof(MailRuleFactJsonConverter))]
public readonly record struct MailRuleFact : IEquatable<MailRuleFact>
Implements
Inherited Members

Remarks

The type is a closed enumeration rather than a C# enum, because a fact is inseparable from the name an owner writes in a condition: that name is a published authoring surface, it has to survive any rename of the member here, and the value shape the type checker judges a comparison against travels with it. A separate mapping table from member to name and type is exactly the pair that drifts apart.

The set is closed on purpose, and closing it is what bounds the cost of a condition. An expression reaches nothing but the facts declared here, every one of them is derived from a single email that has already been stored, and the one fact that costs a read of stored content says so in ReadsStoredContent so that a resolver can leave it alone until a condition names it.

Being a struct, default is reachable and is not a fact. It reports itself through IsSpecified, and the places that must reject it are TryParseName(string?, out MailRuleFact), which never produces it from an undeclared name, and the JSON converter, which refuses to write it.

Properties

Account

Gets the configured alias of the account the email belongs to.

AgeInDays

Gets how many days have passed since the email was received, absent when nothing recorded that.

All

Gets every declared fact.

AttachmentCount

Gets how many attachments the email carries.

AttachmentTotalBytes

Gets the size of every attachment added together.

BodyText

Gets the text extracted from the email's body, absent while no extraction has run for it.

CarriesUnverifiedSignature

Gets whether the email carries a signature part. Nothing has verified it, and the name says so.

Folder

Gets the configured alias of the folder the email occurrence is in.

FolderRole

Gets the special-use role the folder plays for its account, absent when configuration gave it none.

HasExtractedContent

Gets whether text has been extracted from the email's body, which is what makes BodyText readable.

IsAnswered

Gets whether the server reports the email as answered.

IsDraft

Gets whether the server reports the email as a draft.

IsEncrypted

Gets whether the email's body is encrypted.

IsFlagged

Gets whether the server reports the email as flagged.

IsSeen

Gets whether the server reports the email as read.

IsSpecified

Gets whether this value names a declared fact rather than the unusable struct default.

Name

Gets the name a condition refers to the fact by.

ReadsStoredContent

Gets whether resolving the fact reads the email's stored content rather than its already-loaded metadata.

ReceivedAt

Gets when the last receiving hop recorded the email, absent when no hop recorded one.

RecipientAddresses

Gets the addresses the email was sent to and copied to, in their comparison form.

RecipientDomains

Gets the distinct domains of every recipient address.

SenderAddress

Gets the sender's address in its comparison form, absent when the email names no sender.

SenderDomain

Gets the part of the sender's address after the at sign, absent when the email names no sender.

SentAt

Gets when the sender's client stamped the email, absent when it carries no such header.

SizeInBytes

Gets the size of the whole email as the server reported it.

Subject

Gets the subject line, absent when the email carries none.

ValueType

Gets the shape of value the fact carries.

Methods

ToString()

Returns the fully qualified type name of this instance.

TryParseName(string?, out MailRuleFact)

Resolves the fact an expression identifier names, matching case exactly.