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
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
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
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
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
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 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
templateName
stringThe name of the template.
templateDescription
stringThe 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
srcEmail
EmailThe source to base the Email on.
createPagesCopy
boolNeed to copy pages or not
newSubject
stringIf the new Email should get a new subject, this can be specified here.
Returns
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
DateTimeThe start date.
CreateEmailScheduledTask(DateTime, DateTime, TimeZoneInfo)
Creates the scheduled task for email sending.
public void CreateEmailScheduledTask(DateTime startDateTime, DateTime endDateTime, TimeZoneInfo timeZone)
Parameters
startDateTime
DateTimeThe start date.
endDateTime
DateTimeThe end date
timeZone
TimeZoneInfoSpeficies 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
- 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
EmailThe template to base the Email on.
newSubject
stringIf the new Email should get a new subject, this can be specified here.
Returns
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
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
intSpecified 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
stringThe email ids.
conn
IDbConnectionThe conn.
transaction
IDbTransactionThe transaction.
Fill(IDataReader)
Fills the specified data reader.
public override void Fill(IDataReader reader)
Parameters
reader
IDataReaderThe 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
row
DataRowThe 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
stringThe searching filter.
stateFilter
EmailStateFilterThe state filter
Returns
- int
The count of rows
GetEmailById(int)
Gets the email by id.
public static Email GetEmailById(int id)
Parameters
id
intThe id of email.
Returns
The email
GetEmailByMessageId(int)
Gets the email by message id.
public static Email GetEmailByMessageId(int messageId)
Parameters
messageId
intThe 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
pageId
intThe 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
stringThe searching filter.
folderID
intThe folder id.
topFolderId
intThe top folder id.
isShowTopFolderEmails
boolif set to
true
then show top folder emails.stateFilter
EmailStateFilterThe 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
intThe 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()
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
includeTemplates
boolif 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
intThe ID of the emails folder
Returns
GetEmailsByUser(string)
public static EmailCollection GetEmailsByUser(string userKey)
Parameters
userKey
string
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
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
stringThe 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
sort
SortFieldsThe sorting type.
direction
SortDirectionThe direction of sorting.
search
stringThe searching filter.
startItem
intThe start item.
endItem
intThe end item.
stateFilter
EmailStateFilterThe 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
SortFieldsThe sorting type.
direction
SortDirectionThe direction of sorting.
search
stringThe searching filter.
startItem
intThe start item.
endItem
intThe end item.
folderID
intThe folder id.
topFolderId
intThe top folder id.
isShowTopFolderEmails
boolif set to
true
then show top folder emails.stateFilter
EmailStateFilterThe 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
EmailStateFilterThe state of email
emails
EmailCollectionThe 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
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
EmailThe email.
Returns
Save()
Saves current data.
public override void Save()
SendEmail(Email)
Sends the email.
public static bool SendEmail(Email email)
Parameters
email
EmailThe email.
Returns
SendRepeatingEmail(Email)
Sends the repeating email. This method will not return until sending has completed.
public static bool SendRepeatingEmail(Email email)
Parameters
email
EmailThe email.
Returns
SetValuesFromTopFolder(TopFolder)
public void SetValuesFromTopFolder(TopFolder topFolder)
Parameters
Exceptions
- ArgumentException
If parameter 'topFolder' is null, this exception is thrown.
TaskInitialize()
public static void TaskInitialize()