Class Email
- Namespace
- Dynamicweb.EmailMarketing
- Assembly
- Dynamicweb.EmailMarketing.dll
Represents email
public class Email : DbObject
- Inheritance
-
Email
- Inherited Members
Constructors
Email()
Initializes a new instance of the Email class.
public Email()
Properties
CreatedDate
Date when email has been saved
public DateTime CreatedDate { get; set; }
Property Value
DeliveryProvider
Gets the delivery provider.
public MessageDeliveryProviderConfiguration? DeliveryProvider { get; }
Property Value
- MessageDeliveryProviderConfiguration
The delivery provider.
DeliveryProviderId
Gets or sets the delivery provider id.
public int DeliveryProviderId { get; set; }
Property Value
- int
The delivery provider id.
DisableUnsubscribeTag
Gets or sets the value, indicating whether the Unsubscribe tag is disabled.
public bool DisableUnsubscribeTag { get; set; }
Property Value
DomainName
Domain Url
public string? DomainName { get; set; }
Property Value
EmailLastExportDate
Gets or sets the email last export time
public DateTime EmailLastExportDate { get; set; }
Property Value
EmailName
Gets or sets the email name.
public string? EmailName { get; set; }
Property Value
EmailScheduledActive
Gets or sets a value indicating whether the email is scheduled.
public bool EmailScheduledActive { get; set; }
Property Value
- bool
trueif is scheduled; otherwise,false.
EmailScheduledEndTime
Gets or sets the email scheduled end time.
public DateTime EmailScheduledEndTime { get; set; }
Property Value
- DateTime
The email scheduled end time.
EmailScheduledRepeatInterval
Gets or sets the email scheduled repeat interval.
public int EmailScheduledRepeatInterval { get; set; }
Property Value
- int
The email scheduled repeat interval.
EmailScheduledSendTime
Gets or sets the email scheduled send time.
public DateTime EmailScheduledSendTime { get; set; }
Property Value
- DateTime
The email scheduled send time.
EmailState
Gets the state of the email.
public string EmailState { get; }
Property Value
- string
The state of the email.
Encoding
public Encoding Encoding { get; set; }
Property Value
- Encoding
The encoding.
EngagementIndex
Gets or sets the EmailEngagementIndex.
public EmailEngagementIndex? EngagementIndex { get; set; }
Property Value
FileAttachment
Gets the file attachment as a FileInfo object.
public string[] FileAttachment { get; set; }
Property Value
- string[]
FileAttachmentPath
Gets or sets the path where the file to attach is located. This path must be absolute inside Dynamicweb File Archive, eg. "/Images/MyFolder/MyImage.png".
public string? FileAttachmentPath { get; set; }
Property Value
- string
The attached file path.
FolderId
Folder Id
public int FolderId { get; set; }
Property Value
HasFileAttachment
Gets a value indicating whether this Email has a file attachment.
public bool HasFileAttachment { get; }
Property Value
- bool
trueif this instance has file attachment; otherwise,false.
IncludePlainTextContent
Gets or sets whether to include the plain text content.
If this is set to true, a multi-part email is sent using the value from PlainTextContent if it exists, or a stripped version of the HTML content is used.
public bool IncludePlainTextContent { get; set; }
Property Value
- bool
Whether to include plain text content.
IsTemplate
Gets a value indicating whether this instance is template.
public bool IsTemplate { get; }
Property Value
- bool
trueif this instance is template; otherwise,false.
Message
public Message? Message { get; }
Property Value
MessageId
Gets or sets the message id.
public int MessageId { get; set; }
Property Value
- int
The message id.
OriginalMessage
public Message? OriginalMessage { get; set; }
Property Value
OriginalMessageId
Gets or sets the original message id.
public int OriginalMessageId { get; set; }
Property Value
- int
The original message id.
OriginalPreHeader
Domain Url
public string? OriginalPreHeader { get; set; }
Property Value
Page
public Page? Page { get; }
Property Value
PageId
Gets or sets the id Page.
public int PageId { get; set; }
Property Value
- int
The page id.
PlainTextContent
Gets or sets the content of the plain text.
When IncludePlainTextContent is true, this property is used as the plain text part of the multi-part email.
public string? PlainTextContent { get; set; }
Property Value
- string
The content of the plain text.
QuarantinePeriod
Gets or sets the quarantine period (in minutes). The period in which the same Recipient is quarantined from receiving this Email.
This requires RequireUniqueRecipients to be se to false to have effect.
Default is 0.
public int QuarantinePeriod { get; set; }
Property Value
- int
The quarantine period. This cannot be negative. Default is 0, indicating no quarantine period.
RecipientProvider
Gets the recipient provider.
public EmailRecipientProvider? RecipientProvider { get; }
Property Value
RecipientProviderConfiguration
Gets or sets the recipient provider configuration settings.
public string? RecipientProviderConfiguration { get; set; }
Property Value
- string
The recipient provider configuration settings.
RecipientSpecificContent
Gets or sets a value indicating whether to render the content per recipient or once per email.
Default is false.
public bool RecipientSpecificContent { get; set; }
Property Value
- bool
trueif content is rendered once per recipient; otherwise,false.
RequireUniqueRecipients
Gets or sets a value indicating whether require unique recipients.
This value propergates down to the underlying EmailMessaging API.
Default is true.
public bool RequireUniqueRecipients { get; set; }
Property Value
- bool
trueif recipients are required to be unique; otherwise,false. Default istrue.
SenderEmail
Gets or sets the sender email.
public string? SenderEmail { get; set; }
Property Value
- string
The sender email.
SenderName
Gets or sets the name of the sender.
public string? SenderName { get; set; }
Property Value
- string
The name of the sender.
Subject
Gets or sets the subject.
public string? Subject { get; set; }
Property Value
- string
The subject.
Template
Gets or sets the template.
public string? Template { get; set; }
Property Value
- string
The template.
TemplateDescription
Gets or sets the template description.
public string? TemplateDescription { get; set; }
Property Value
- string
The template description.
TemplateName
Gets or sets the name of the template.
public string? TemplateName { get; set; }
Property Value
- string
The name of the template.
TopFolderId
Gets or sets the top folder ID of the email.
public int TopFolderId { get; set; }
Property Value
- int
The top folder ID.
TrackingProvider
Gets the EmailTrackingProvider.
public EmailTrackingProvider? TrackingProvider { get; }
Property Value
TrackingProviderConfiguration
Gets or sets the configuration for the EmailTrackingProvider.
public string? TrackingProviderConfiguration { get; set; }
Property Value
- string
The tracking provider configuration.
UnsubscribePageId
Gets or sets the Id for the Page where Unsubscribe is located.
public int UnsubscribePageId { get; set; }
Property Value
- int
The unsubscription page id.
UnsubscribeText
Gets or sets the description text for the Page where Unsubscribe is located.
public string? UnsubscribeText { get; set; }
Property Value
- string
The unsubscription page text.
Methods
CancelSchedule()
Cancels the scheduling of this Email.
public void CancelSchedule()
Copy()
Copies the instance of email.
public Email Copy()
Returns
The object of Dynamicweb.Modules.EmailMarketing.Email
CopyAsTemplate(string, string)
public Email CopyAsTemplate(string templateName, string templateDescription)
Parameters
templateNamestringThe name of the template.
templateDescriptionstringThe description for the template.
Returns
CopyPages(Email, Email, string?)
public static void CopyPages(Email srcEmail, Email targetEmail, string? newSubject)
Parameters
CreateCopy(Email, bool, string?)
Creates a new Email from an email source object. The Email has not been saved. If there are Page objects associated with the template, then these pages are copied without sub pages in the page tree and the new page ids are associated with the new Email.
public static Email CreateCopy(Email srcEmail, bool createPagesCopy, string? newSubject)
Parameters
srcEmailEmailThe source to base the Email on.
createPagesCopyboolNeed to copy pages or not
newSubjectstringIf the new Email should get a new subject, this can be specified here.
Returns
Exceptions
- ArgumentNullException
The
srcEmailis null.- ArgumentException
Object 'template' is not marked as a template. Check template.IsTemplate property.
- InvalidOperationException
Object 'template' is created with page cannot be copied. Check template.PageId property.
CreateEmailScheduledTask(DateTime)
Creates the scheduled task for email sending.
public void CreateEmailScheduledTask(DateTime startDateTime)
Parameters
startDateTimeDateTimeThe start date.
CreateEmailScheduledTask(DateTime, DateTime, TimeZoneInfo?)
Creates the scheduled task for email sending.
public void CreateEmailScheduledTask(DateTime startDateTime, DateTime endDateTime, TimeZoneInfo? timeZone)
Parameters
startDateTimeDateTimeThe start date.
endDateTimeDateTimeThe end date
timeZoneTimeZoneInfoSpeficies the timezone to convert the given DateTime to. If not timezone is speficied, the local timezone is used.
CreateFromTemplate(Email)
Creates a new Email from an email template object. The Email has not been saved. If there are Page objects associated with the template, then these pages are copied without sub pages in the page tree and the new page ids are associated with the new Email.
public static Email CreateFromTemplate(Email template)
Parameters
Returns
Exceptions
- ArgumentNullException
The
templateis null.- ArgumentException
Object 'template' is not marked as a template. Check template.IsTemplate property.
CreateFromTemplate(Email, string?)
Creates a new Email from an email template object. The Email has not been saved. If there are Page objects associated with the template, then these pages are copied without sub pages in the page tree and the new page ids are associated with the new Email.
public static Email CreateFromTemplate(Email template, string? newSubject)
Parameters
templateEmailThe template to base the Email on.
newSubjectstringIf the new Email should get a new subject, this can be specified here.
Returns
Exceptions
- ArgumentNullException
The
templateis null.- ArgumentException
Object 'template' is not marked as a template. Check template.IsTemplate property.
- InvalidOperationException
Object 'template' is created with page cannot be copied. Check template.PageId property.
CreateMessage()
Creates the message for email.
public Message CreateMessage()
Returns
- Message
The instance of Dynamicweb.EmailMessaging.Message
CreateMessageForEngagementIndex(bool, int)
Creates the message for engagement index.
public Message? CreateMessageForEngagementIndex(bool isEmailSaved, int pageId)
Parameters
Returns
- Message
The object of type Dynamicweb.EmailMessaging.Message
Delete(int)
Deletes the object with specified ID.
public override void Delete(int id)
Parameters
idintSpecified ID.
DeleteBulk(string, IDbConnection, IDbTransaction)
Deletes the emails with the ids specified. The id list can also be a SQL selector for the given ids. EmailEngagementIndex related the the Emails will also be deleted.
public static void DeleteBulk(string emailIds, IDbConnection conn, IDbTransaction transaction)
Parameters
emailIdsstringThe email ids.
connIDbConnectionThe conn.
transactionIDbTransactionThe transaction.
Fill(IDataReader)
Fills the specified data reader.
public override void Fill(IDataReader reader)
Parameters
readerIDataReaderThe data reader.
FillMessageForPreview(int, bool)
Fills the message.
public Message FillMessageForPreview(int pageId, bool isEmailSaved)
Parameters
Returns
- Message
The object of type Dynamicweb.EmailMessaging.Message
FillRow(DataRow)
Fills the data row.
protected override void FillRow(DataRow row)
Parameters
rowDataRowThe data row.
GetAutomationEmailsCount(string?, EmailStateFilter)
Gets the amount of automation(scheduled/recurring) emails by searching filter.
public static int GetAutomationEmailsCount(string? search, EmailStateFilter stateFilter)
Parameters
searchstringThe searching filter.
stateFilterEmailStateFilterThe state filter
Returns
- int
The count of rows
GetEmailById(int)
Gets the email by id.
public static Email? GetEmailById(int id)
Parameters
idintThe id of email.
Returns
The email
GetEmailByMessageId(int)
Gets the email by message id.
public static Email? GetEmailByMessageId(int messageId)
Parameters
messageIdintThe message id.
Returns
GetEmailCountByFolderName(string, int)
Gets the count of emails by folder name.
public static int GetEmailCountByFolderName(string folderName, int topFolderID)
Parameters
Returns
- int
The count of emails in specified folder
GetEmailCountByPageId(int)
Gets the email count by page id.
public static int GetEmailCountByPageId(int pageId)
Parameters
pageIdintThe page id.
Returns
- int
The number of emails where the given page is used as email content - including variations.
GetEmailCountBySearchValueAndFolderId(string?, int, int, bool, EmailStateFilter)
Gets the amount of emails by searching filter.
public static int GetEmailCountBySearchValueAndFolderId(string? search, int folderID, int topFolderId, bool isShowTopFolderEmails, EmailStateFilter stateFilter)
Parameters
searchstringThe searching filter.
folderIDintThe folder id.
topFolderIdintThe top folder id.
isShowTopFolderEmailsboolif set to
truethen show top folder emails.stateFilterEmailStateFilterThe state filter
Returns
- int
The count of rows
GetEmailCountByTopFolderId(int)
Gets the count of emails by top folder id.
public static int GetEmailCountByTopFolderId(int topFolderID)
Parameters
topFolderIDintThe id of the top folder
Returns
- int
The count on emails for specified top folder
GetEmailOpeningRate()
Gets the email opening rate at the given time
public double GetEmailOpeningRate()
Returns
- double
The date when email will be sent
GetEmailSentCompletedTime()
public DateTime GetEmailSentCompletedTime()
Returns
- DateTime
The date when email completed sending.
GetEmailSentStartTime()
public DateTime GetEmailSentStartTime()
Returns
- DateTime
The date when email started sending.
GetEmailTemplates()
Gets the Email Templates.
public static EmailCollection GetEmailTemplates()
Returns
- EmailCollection
The collection of all Email Templates without any filtering
GetEmailTotalSent()
Gets how many mails has been sent.
public int GetEmailTotalSent()
Returns
- int
The date when email will be sent
GetEmails()
Gets the emails. The EmailCollection does not contain Email Templates. Use GetEmails(true) to include templates.
public static EmailCollection GetEmails()
Returns
- EmailCollection
The collection of all emails without any filtering
GetEmails(bool)
Gets the emails.
public static EmailCollection GetEmails(bool includeTemplates)
Parameters
includeTemplatesboolif set to
true, the collection will contain Email Templates also.
Returns
- EmailCollection
The collection of all emails without any filtering
GetEmailsByFolderId(int)
Gets the emails collection by folder ID.
public static EmailCollection GetEmailsByFolderId(int folderID)
Parameters
folderIDintThe ID of the emails folder
Returns
GetEmailsByUser(string)
public static EmailCollection GetEmailsByUser(string userKey)
Parameters
userKeystring
Returns
GetEmailsByUser(string, int)
public static EmailCollection GetEmailsByUser(string userKey, int messageID)
Parameters
Returns
GetLastSentEmails(int)
Gets the updated emails since last export and not yet exported emails.
public static EmailCollection GetLastSentEmails(int count)
Parameters
countint
Returns
- EmailCollection
The collection of all Email Templates without any filtering
GetMessagesByUser(string)
Gets the messages by user.
public static List<Tuple<int, string, DateTime>> GetMessagesByUser(string userKey)
Parameters
userKeystringThe user key.
Returns
GetPagedAutomationEmailsList(SortFields, SortDirection, string?, int, int, EmailStateFilter)
Gets the paged automation(scheduled/recurring) emails list.
public static EmailCollection GetPagedAutomationEmailsList(SortFields sort, SortDirection direction, string? search, int startItem, int endItem, EmailStateFilter stateFilter)
Parameters
sortSortFieldsThe sorting type.
directionSortDirectionThe direction of sorting.
searchstringThe searching filter.
startItemintThe start item.
endItemintThe end item.
stateFilterEmailStateFilterThe state filter
Returns
- EmailCollection
The collection of emails
GetPagedEmailList(SortFields, SortDirection, string?, int, int, int, int, bool, EmailStateFilter)
Gets the paged email list.
public static EmailCollection GetPagedEmailList(SortFields sort, SortDirection direction, string? search, int startItem, int endItem, int folderID, int topFolderId, bool isShowTopFolderEmails, EmailStateFilter stateFilter)
Parameters
sortSortFieldsThe sorting type.
directionSortDirectionThe direction of sorting.
searchstringThe searching filter.
startItemintThe start item.
endItemintThe end item.
folderIDintThe folder id.
topFolderIdintThe top folder id.
isShowTopFolderEmailsboolif set to
truethen show top folder emails.stateFilterEmailStateFilterThe state filter
Returns
- EmailCollection
The collection of emails
GetStateFilteredEmails(EmailStateFilter, EmailCollection)
Gets fileter by state emails collection.
public static EmailCollection GetStateFilteredEmails(EmailStateFilter stateFilter, EmailCollection emails)
Parameters
stateFilterEmailStateFilterThe state of email
emailsEmailCollectionThe unfilterd email collection
Returns
- EmailCollection
The collection of filtered emails by state
GetUpdatedEmailsFromLastExport()
Gets the updated emails since last export and not yet exported emails.
public static EmailCollection GetUpdatedEmailsFromLastExport()
Returns
- EmailCollection
The collection of all Email Templates without any filtering
IsEmailDraft()
public bool IsEmailDraft()
Returns
IsEmailScheduled()
Determines whether an email has scheduled send.
public bool IsEmailScheduled()
Returns
- bool
trueif an email has scheduled send; otherwise,false.
IsEmailSending()
Determines whether the email is currently being sent.
public bool IsEmailSending()
Returns
- bool
trueif email is being sent; otherwise,false.
IsEmailSendingFailed()
Determines whether the email is incomplete.
public bool IsEmailSendingFailed()
Returns
- bool
trueif email is incomplete; otherwise,false.
IsEmailSent()
Determines whether the email has been sent.
public bool IsEmailSent()
Returns
- bool
trueif email has been sent; otherwise,false.
PutEmailsToSystemFolders()
Puts the emails to system folders.
public static void PutEmailsToSystemFolders()
RetryEmail(Email)
Retries the email.
public static bool RetryEmail(Email email)
Parameters
emailEmailThe email.
Returns
Save()
Saves current data.
public override void Save()
SendEmail(Email)
Sends the email.
public static bool SendEmail(Email email)
Parameters
emailEmailThe email.
Returns
SendRepeatingEmail(Email)
Sends the repeating email. This method will not return until sending has completed.
public static bool SendRepeatingEmail(Email email)
Parameters
emailEmailThe email.
Returns
SetValuesFromTopFolder(TopFolder)
public void SetValuesFromTopFolder(TopFolder topFolder)
Parameters
Exceptions
- ArgumentNullException
If parameter 'topFolder' is null, this exception is thrown.
TaskInitialize()
public static void TaskInitialize()