November Happy Hour will be moved to Thursday December 5th.

Class SubscriptionMail

The class that handles sending of mail notifications for subscriptions, used by SubscriptionJob.

Inheritance
System.Object
SubscriptionMail
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Personalization
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
[SubscriptionPlugIn(DisplayName = "Default subscription handler", LanguagePath = "/admin/settings/defaultsubscriptionhandler")]
public class SubscriptionMail : ISubscriptionHandler
Remarks

This subscription handler is going to deliver one subscription mail for each subscription root and language for the subcription, if it exists changed pages for it.

The text for the "Read More..." text is taken from the page property "MailReadMore" on the subscription root.

The subject of the mail is generated from the page property "MailSubject" on the subscription root.

The mail from address generated from the "MailFrom" page property on the subscription root.

The stylesheet is taken from the web.config

 
<episerver xmlns="http://EPiServer.Configuration.EPiServerSection">
  <sites>
    <site description="Example Site">
      <siteSettings 
        ...
        uiEditorCssPaths="~/MyCss.css"

Constructors

SubscriptionMail()

Declaration
public SubscriptionMail()

SubscriptionMail(LocalizationService, SiteDefinitionResolver)

Declaration
public SubscriptionMail(LocalizationService localizationService, SiteDefinitionResolver siteDefinitionResolver)
Parameters
Type Name Description
LocalizationService localizationService
SiteDefinitionResolver siteDefinitionResolver

Properties

User

SID

Declaration
public string User { get; set; }
Property Value
Type Description
System.String

UserData

Personalized information

Declaration
public EPiServerProfile UserData { get; set; }
Property Value
Type Description
EPiServerProfile

Methods

FormatPageForBody(PageData, PageData)

Format info for a page that has changed and will be included inside the body of a subscription mail.

Declaration
public virtual string FormatPageForBody(PageData subscriptionPage, PageData page)
Parameters
Type Name Description
PageData subscriptionPage

The subscription page

PageData page

Page that holds information that needs to be be formatted

Returns
Type Description
System.String

A string that contains HTML by default

GenerateBody(PageData, PageDataCollection)

Create the Html for the subscription mail body.

Declaration
public virtual string GenerateBody(PageData subscriptionPage, PageDataCollection changedPagesReadOnly)
Parameters
Type Name Description
PageData subscriptionPage

The subscription template page.

PageDataCollection changedPagesReadOnly

A collection of readonly pages that have changed.

Returns
Type Description
System.String

The complete Html for the mail body ("<html>.... </html>").

Remarks

Call the GetCSSContents() function to fetch any CSS data that should be included in the html.

GetCSSContents()

Return the CSS data that is included in the subscription mail. By default this means fetching the contents of the file defined by the key EPsEditCSS in web.config. Any C style comments are automatically removed from the string before it is returned.

Declaration
public virtual string GetCSSContents()
Returns
Type Description
System.String

A string with CSS data

Remarks

Do not include any <style> tags in the string that is returned.

IsValidEmailAddress(String)

Check if an email address conforms to the RFC 2822 email address protocol. For more information, see http://rfc.net/rfc2822.html.

Declaration
public virtual bool IsValidEmailAddress(string address)
Parameters
Type Name Description
System.String address

Email address to check

Returns
Type Description
System.Boolean

True if valid address, otherwise false

Send(PageData, PageDataCollection)

Send an e-mail to user with information about changed pages.

Declaration
public virtual void Send(PageData subscriptionRootPage, PageDataCollection changedPages)
Parameters
Type Name Description
PageData subscriptionRootPage

The root page for the subscription that this mail should be based on

PageDataCollection changedPages

The changed pages to notify the user about

Remarks

Create the subscription part of the body by calling the GenerateBody(PageData, PageDataCollection) function.

Implements

Extension Methods