Table of Contents

Method NamedRecipients

Namespace
MailFathom.Application.Mail.Delivery.Addressing
Assembly
MailFathom.Application.dll

NamedRecipients(IReadOnlyList<string>?, IReadOnlyList<string>?, IReadOnlyList<string>?, Func<MailFathomException>, Func<AuthoredEmailRefusal, MailFathomException>)

Collects the three headers into the one recipient list every author writes.

public static IReadOnlyList<NamedRecipient> NamedRecipients(IReadOnlyList<string>? to, IReadOnlyList<string>? cc, IReadOnlyList<string>? bcc, Func<MailFathomException> tooManyRecipients, Func<AuthoredEmailRefusal, MailFathomException> fieldUnusable)

Parameters

to IReadOnlyList<string>

The addresses named in the To header, or null where the act names none.

cc IReadOnlyList<string>

The addresses named in the Cc header, or null.

bcc IReadOnlyList<string>

The addresses named in the Bcc header, or null.

tooManyRecipients Func<MailFathomException>

Raises the caller's own refusal for a list longer than a record holds.

fieldUnusable Func<AuthoredEmailRefusal, MailFathomException>

Raises the caller's own refusal for a header carrying an entry that names nobody.

Returns

IReadOnlyList<NamedRecipient>

The recipients the author named, in the order the headers are read in.

Remarks

The order is the order the headers are read in, which is the order the composition writes them in. Nothing is deduplicated or parsed here: whether text names a mailbox is the composition's question, and how many people a message may actually reach is the deployment's number, both asked once for every way a message is authored. What is answered here is only how long the caller's own lists are, because that is what decides whether they are expanded at all, and the check therefore belongs in front of the expansion rather than after it.

A send and a draft read the same headers and refuse the same values, and differ only in the failure they raise: a caller told its submission was refused while saving a draft would read that as a message having been offered to a server and turned down, which is the one thing that certainly did not happen. So the act supplies the two refusals rather than the reading being written twice, and the code and the sentence stay the same either way because both are published from one place.

Exceptions

ArgumentNullException

Thrown when tooManyRecipients or fieldUnusable is null.

MailFathomException

Thrown as whichever refusal the act supplied, when the three headers name more people than a record holds or an entry carries no address.