Table of Contents

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

DateTime

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

bool

DomainName

Domain Url

public string DomainName { get; set; }

Property Value

string

EmailLastExportDate

Gets or sets the email last export time

public DateTime EmailLastExportDate { get; set; }

Property Value

DateTime

EmailName

Gets or sets the email name.

public string EmailName { get; set; }

Property Value

string

EmailScheduledActive

Gets or sets a value indicating whether the email is scheduled.

public bool EmailScheduledActive { get; set; }

Property Value

bool

true if 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

Gets or sets the Encoding used in this Email.

public Encoding Encoding { get; set; }

Property Value

Encoding

The encoding.

EngagementIndex

Gets or sets the EmailEngagementIndex.

public EmailEngagementIndex EngagementIndex { get; set; }

Property Value

EmailEngagementIndex

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

int

HasFileAttachment

Gets a value indicating whether this Email has a file attachment.

public bool HasFileAttachment { get; }

Property Value

bool

true if 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

true if this instance is template; otherwise, false.

Message

public Message Message { get; }

Property Value

Message

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

Message

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

string

Page

Gets the Page where the content of the Email is located.

public Page Page { get; }

Property Value

Page

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

EmailRecipientProvider

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

true if 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

true if recipients are required to be unique; otherwise, false. Default is true.

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

public EmailTrackingProvider TrackingProvider { get; }

Property Value

EmailTrackingProvider

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

Email

The object of Dynamicweb.Modules.EmailMarketing.Email

CopyAsTemplate(string, string)

Copies this Email as a template. The Email template has not been saved.

public Email CopyAsTemplate(string templateName, string templateDescription)

Parameters

templateName string

The name of the template.

templateDescription string

The description for the template.

Returns

Email

CopyPages(Email, Email, string)

public static void CopyPages(Email srcEmail, Email targetEmail, string newSubject)

Parameters

srcEmail Email
targetEmail Email
newSubject string

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

srcEmail Email

The source to base the Email on.

createPagesCopy bool

Need to copy pages or not

newSubject string

If the new Email should get a new subject, this can be specified here.

Returns

Email

Exceptions

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

startDateTime DateTime

The start date.

CreateEmailScheduledTask(DateTime, DateTime, TimeZoneInfo)

Creates the scheduled task for email sending.

public void CreateEmailScheduledTask(DateTime startDateTime, DateTime endDateTime, TimeZoneInfo timeZone)

Parameters

startDateTime DateTime

The start date.

endDateTime DateTime

The end date

timeZone TimeZoneInfo

Speficies 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

template Email

The template to base the Email on.

Returns

Email

Exceptions

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

template Email

The template to base the Email on.

newSubject string

If the new Email should get a new subject, this can be specified here.

Returns

Email

Exceptions

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

isEmailSaved bool

if set to truethen email has been saved.

pageId int

The page id.

Returns

Message

The object of type Dynamicweb.EmailMessaging.Message

Delete(int)

Deletes the object with specified ID.

public override void Delete(int id)

Parameters

id int

Specified 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

emailIds string

The email ids.

conn IDbConnection

The conn.

transaction IDbTransaction

The transaction.

Fill(IDataReader)

Fills the specified data reader.

public override void Fill(IDataReader reader)

Parameters

reader IDataReader

The data reader.

FillMessageForPreview(int, bool)

Fills the message.

public Message FillMessageForPreview(int pageId, bool isEmailSaved)

Parameters

pageId int

The page id.

isEmailSaved bool

if set to truethen email has been saved.

Returns

Message

The object of type Dynamicweb.EmailMessaging.Message

FillRow(DataRow)

Fills the data row.

protected override void FillRow(DataRow row)

Parameters

row DataRow

The 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

search string

The searching filter.

stateFilter EmailStateFilter

The state filter

Returns

int

The count of rows

GetEmailById(int)

Gets the email by id.

public static Email GetEmailById(int id)

Parameters

id int

The id of email.

Returns

Email

The email

GetEmailByMessageId(int)

Gets the email by message id.

public static Email GetEmailByMessageId(int messageId)

Parameters

messageId int

The message id.

Returns

Email

GetEmailCountByFolderName(string, int)

Gets the count of emails by folder name.

public static int GetEmailCountByFolderName(string folderName, int topFolderID)

Parameters

folderName string

The name of the emails folder

topFolderID int

The top folder ID

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

pageId int

The 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

search string

The searching filter.

folderID int

The folder id.

topFolderId int

The top folder id.

isShowTopFolderEmails bool

if set to truethen show top folder emails.

stateFilter EmailStateFilter

The 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

topFolderID int

The 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

GetEmailScheduledDate()

Gets the email scheduled date.

public DateTime GetEmailScheduledDate()

Returns

DateTime

The date when email will be sent

GetEmailSentCompletedTime()

Gets the DateTime for when this Email completed sending.

public DateTime GetEmailSentCompletedTime()

Returns

DateTime

The date when email completed sending.

GetEmailSentStartTime()

Gets the DateTime for when this Email started sending.

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

includeTemplates bool

if 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

folderID int

The ID of the emails folder

Returns

EmailCollection

GetEmailsByUser(string)

public static EmailCollection GetEmailsByUser(string userKey)

Parameters

userKey string

Returns

EmailCollection

GetEmailsByUser(string, int)

public static EmailCollection GetEmailsByUser(string userKey, int messageID)

Parameters

userKey string
messageID int

Returns

EmailCollection

GetLastSentEmails(int)

Gets the updated emails since last export and not yet exported emails.

public static EmailCollection GetLastSentEmails(int count)

Parameters

count int

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

userKey string

The user key.

Returns

List<Tuple<int, string, DateTime>>

List of messages

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

sort SortFields

The sorting type.

direction SortDirection

The direction of sorting.

search string

The searching filter.

startItem int

The start item.

endItem int

The end item.

stateFilter EmailStateFilter

The 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

sort SortFields

The sorting type.

direction SortDirection

The direction of sorting.

search string

The searching filter.

startItem int

The start item.

endItem int

The end item.

folderID int

The folder id.

topFolderId int

The top folder id.

isShowTopFolderEmails bool

if set to truethen show top folder emails.

stateFilter EmailStateFilter

The 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

stateFilter EmailStateFilter

The state of email

emails EmailCollection

The 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

bool

IsEmailScheduled()

Determines whether an email has scheduled send.

public bool IsEmailScheduled()

Returns

bool

true if an email has scheduled send; otherwise, false.

IsEmailSending()

Determines whether the email is currently being sent.

public bool IsEmailSending()

Returns

bool

true if email is being sent; otherwise, false.

IsEmailSendingFailed()

Determines whether the email is incomplete.

public bool IsEmailSendingFailed()

Returns

bool

true if email is incomplete; otherwise, false.

IsEmailSent()

Determines whether the email has been sent.

public bool IsEmailSent()

Returns

bool

true if 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

email Email

The email.

Returns

bool

Save()

Saves current data.

public override void Save()

SendEmail(Email)

Sends the email.

public static bool SendEmail(Email email)

Parameters

email Email

The email.

Returns

bool

SendRepeatingEmail(Email)

Sends the repeating email. This method will not return until sending has completed.

public static bool SendRepeatingEmail(Email email)

Parameters

email Email

The email.

Returns

bool

SetValuesFromTopFolder(TopFolder)

Sets the default values from the TopFolder on the Email including id.

public void SetValuesFromTopFolder(TopFolder topFolder)

Parameters

topFolder TopFolder

The TopFolder to fill default values from.

Exceptions

ArgumentException

If parameter 'topFolder' is null, this exception is thrown.

TaskInitialize()

public static void TaskInitialize()
To top