Table of Contents

Method TryCreate

Namespace
MailFathom.Domain.Emails
Assembly
MailFathom.Domain.dll

TryCreate(string?, string?, out EmailAddress)

Builds a participant address from the parts a mail header supplied.

public static bool TryCreate(string? displayName, string? address, out EmailAddress emailAddress)

Parameters

displayName string

The display name the header carried, if any.

address string

The addr-spec the header carried.

emailAddress EmailAddress

The normalized address, when the addr-spec is usable.

Returns

bool

true when the address is usable; otherwise false.

Remarks

A malformed address is refused rather than repaired, because guessing what an unparseable header meant would put an address nobody wrote into a filter someone later trusts. Refusal costs one participant of one message, which is why extraction skips it instead of failing the message.