Table of Contents

Class EmailInfoProvider

Namespace
CMS.EmailEngine
Assembly
CMS.EmailEngine.dll

Class providing EmailInfo management.

[ProviderInterface(typeof(IEmailInfoProvider))]
[Obsolete("Use CMS.DataEngine.IInfoProvider<EmailInfo> instead. Use CMS.DataEngine.InfoProviderExtensions for additional methods for individual objects retrieval. To get an instance of the interface's implementation use dependency injection or access the instance directly via the CMS.DataEngine.Provider<EmailInfo>.Instance property. When faking metadata in CMS.Tests.UnitTests using Fake() use the obsolete provider class until fully removed.")]
[ObsoleteSince(29, 4)]
public class EmailInfoProvider : AbstractInfoProvider<EmailInfo, EmailInfoProvider>, IInfoProvider, ICustomizableProvider, IBulkOperationProvider, IWebFarmProvider, IInfoValidator<EmailInfo>, IInfoByGuidProvider<EmailInfo>, IInfoByNameProvider<EmailInfo>, IBulkInfoProvider<EmailInfo>, IEmailInfoProvider, IInfoProvider<EmailInfo>, IInfoByIdProvider<EmailInfo>
Inheritance
object
EmailInfoProvider
Implements
Inherited Members
Extension Methods

Methods

BindEmailAttachment(int, string, string, string, int, byte[], string, Guid, DateTime)

Add attachment to specified e-mail and return its ID.

[Obsolete("Use CMS.EmailEngine.EmailInfoUtils.BindAttachment(int, string, string, string, int, byte[], string, Guid, DateTime) instead.")]
[ObsoleteSince(29, 4)]
public static int BindEmailAttachment(int emailId, string name, string extension, string mimetype, int size, byte[] binary, string contentId, Guid guid, DateTime lastModified)

Parameters

emailId int

E-mail

name string

Attachment name

extension string

Attachment extension

mimetype string

Attachment type

size int

Size of the attachment

binary byte[]

Binary data

contentId string

Attachment content ID

guid Guid

Attachment GUID

lastModified DateTime

Last modification date of the attachment

Returns

int

DeleteAll(EmailStatusEnum, bool)

Deletes all EmailInfo objects with specific parameters.

[Obsolete("The method is no longer used by the system and will be removed.")]
[ObsoleteSince(29, 4)]
public static void DeleteAll(EmailStatusEnum status, bool onlyFailed)

Parameters

status EmailStatusEnum

E-mail status

onlyFailed bool

If true failed e-mails are deleted, failed e-mail status is waiting

DeleteArchived(DateTime, int)

Deletes expired archived e-mails. Size of deleted "batch" is specified by batchSize.

[Obsolete("Use CMS.EmailEngine.EmailInfoUtils.DeleteArchived(DateTime, int) instead.")]
[ObsoleteSince(29, 4)]
public static int DeleteArchived(DateTime expirationDate, int batchSize)

Parameters

expirationDate DateTime

Every archived email older that expiration date will be deleted

batchSize int

Number of emails to be deleted at once

Returns

int

Returns number of deleted emails.

FetchEmails(EmailMailoutEnum, int, int, DateTime?)

Fetches e-mails which should be sent and marks them as being sent.

[Obsolete("Method was not intended for public use and will be removed in the next version.")]
[ObsoleteSince(29, 4)]
public static DataSet FetchEmails(EmailMailoutEnum emailsToFetch, int firstEmailId, int batchSize, DateTime? failedEmailsNewerThan = null)

Parameters

emailsToFetch EmailMailoutEnum

Determines which e-mails are to be fetched

firstEmailId int

First email ID (only e-mails with the same or higher ID are fetched)

batchSize int

Number of e-mails to retrieve; default value is 0 - in this case batch size is retrieved from Settings

failedEmailsNewerThan DateTime?

Timestamp indicating that only failed emails that are younger than given date should be sent. Only works for Failed.

Returns

DataSet

DataSet with fetched e-mails

GetEmailExpirationTime()

Gets email expiration time for archived emails.

[Obsolete("Use the CMS.EmailEngine.EmailQueueOptions.ArchiveDuration property directly (using the options pattern).")]
[ObsoleteSince(29, 4)]
public static DateTime GetEmailExpirationTime()

Returns

DateTime

GetExpiredEmailCount(DateTime)

Gets the number of archived emails that are older that expiration date.

[Obsolete("Use CMS.EmailEngine.EmailInfoProviderExtensions.GetExpiredCount(IInfoProvider<EmailInfo>, DateTime) instead.")]
[ObsoleteSince(29, 4)]
public static int GetExpiredEmailCount(DateTime expirationDate)

Parameters

expirationDate DateTime

Expiration date.

Returns

int

ResendEmails(IEnumerable<int>, CancellationToken)

Re-sends e-mails specified by their IDs. If some of the specified emails are already being sent, they are NOT send again.

[Obsolete("Use CMS.EmailEngine.EmailInfoUtils.Resend(IEnumerable<int>, CancellationToken) instead.")]
[ObsoleteSince(29, 4)]
public static Task ResendEmails(IEnumerable<int> ids, CancellationToken cancellationToken)

Parameters

ids IEnumerable<int>

IDs of the emails that are to be sent

cancellationToken CancellationToken

Cancellation token.

Returns

Task

SetEmailInfo(EmailMessage, bool)

Creates new EmailInfo from EmailMessage.

[Obsolete("Use CMS.EmailEngine.EmailInfoProviderExtensions.SetMessage(IInfoProvider<EmailInfo>, EmailMessage, bool) instead.")]
[ObsoleteSince(29, 4)]
public static EmailInfo SetEmailInfo(EmailMessage message, bool dontSend = false)

Parameters

message EmailMessage

Email message

dontSend bool

If true, e-mail status remains 'being created' so it could not be sent

Returns

EmailInfo

EmailInfo object