Class UserMailCollection
Queued mail to users, default collection name UserMail.
public class UserMailCollection : DiskRepositoryCollectionBase<UserMailEntity>, IUserMailCollection, IDiskRepositoryCollection<UserMailEntity>, IDiskRepositoryCollection<UserMailEntity, ObjectId>, IRepositoryCollection<UserMailEntity, ObjectId>, IReadOnlyRepositoryCollection<UserMailEntity, ObjectId>, IRepositoryCollection, IReadOnlyRepositoryCollection
- Inheritance
-
RepositoryCollectionBaseDiskRepositoryCollectionBase<UserMailEntity>UserMailCollection
- Implements
-
IDiskRepositoryCollection<UserMailEntity>IRepositoryCollectionIReadOnlyRepositoryCollection
- Inherited Members
-
DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.GetCollection()DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.DropCollectionAsync()DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.GetDirtyAsync()DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.GetFailedIndices()DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.DropEmptyAsync(IMongoCollection<UserMailEntity>)DiskRepositoryCollectionBase<UserMailEntity, ObjectId>.FetchSizeRepositoryCollectionBase<UserMailEntity, ObjectId>._mongoDbServiceFactoryRepositoryCollectionBase<UserMailEntity, ObjectId>._loggerRepositoryCollectionBase<UserMailEntity, ObjectId>._databaseContextRepositoryCollectionBase<UserMailEntity, ObjectId>._mongoDbServiceRepositoryCollectionBase<UserMailEntity, ObjectId>.InitAsync(IMongoCollection<UserMailEntity>)RepositoryCollectionBase<UserMailEntity, ObjectId>.ProtectedCollectionNameRepositoryCollectionBase<UserMailEntity, ObjectId>.CollectionNameRepositoryCollectionBase<UserMailEntity, ObjectId>.DatabasePartRepositoryCollectionBase<UserMailEntity, ObjectId>.ConfigurationNameRepositoryCollectionBase<UserMailEntity, ObjectId>.AutoCleanRepositoryCollectionBase<UserMailEntity, ObjectId>.CleanOnStartupRepositoryCollectionBase<UserMailEntity, ObjectId>.CreateCollectionStrategyRepositoryCollectionBase<UserMailEntity, ObjectId>.IndicesRepositoryCollectionBase<UserMailEntity, ObjectId>.CoreIndicesRepositoryCollectionBase<UserMailEntity, ObjectId>.TypesRepositoryCollectionBase.ConfigurationNameRepositoryCollectionBase.ActionEvent
Remarks
Due mail is found by status and due time; a deduplication key is unique where one was given; a batch's mail by its
batch and status; a user's history by their key or address, newest first; the mail about a team by the team, newest first,
the rest of the global log being read newest first by id; a sent mail by the Message-ID a bounce
report names; how often each category was sent by status, completion, category and recipient, read from the index
alone, and how often each contact category was by kind, status, completion, category and address, read from an index
of its own; and a mail that is done expires after UserMailRetention, while a queued one never
does.
Constructors
UserMailCollection(IMongoDbServiceFactory, ILogger<UserMailCollection>, IOptions<ThargaTeamOptions>)
Creates the collection under the configured name and retention.
public UserMailCollection(IMongoDbServiceFactory mongoDbServiceFactory, ILogger<UserMailCollection> logger, IOptions<ThargaTeamOptions> options = null)
Parameters
mongoDbServiceFactoryIMongoDbServiceFactoryloggerILogger<UserMailCollection>optionsIOptions<ThargaTeamOptions>
Properties
CollectionName
public override string CollectionName { get; }
Property Value
Indices
public override IEnumerable<CreateIndexModel<UserMailEntity>> Indices { get; }
Property Value
- IEnumerable<CreateIndexModel<UserMailEntity>>
Retention
How long a mail is kept once it is done.
public TimeSpan Retention { get; }
Property Value
Methods
CountSentByCategoryAsync(DateTime, CancellationToken)
For each category, the mails sent or bounced to a user since since, and to how many users, in one aggregation on the server.
public Task<IReadOnlyList<UserMailCategorySent>> CountSentByCategoryAsync(DateTime since, CancellationToken cancellationToken = default)
Parameters
sinceDateTimecancellationTokenCancellationToken
Returns
CountSentToContactsByCategoryAsync(DateTime, CancellationToken)
For each contact category, the contact mails sent or bounced since since, and to how many distinct addresses, in one aggregation on the server.
public Task<IReadOnlyList<UserMailCategorySent>> CountSentToContactsByCategoryAsync(DateTime since, CancellationToken cancellationToken = default)
Parameters
sinceDateTimecancellationTokenCancellationToken