Monday, 19 March 2012

And I'm still discovering ECM :)

There is a new version of ECM that is going to be released soon. Well, now, when I'm going to publish this post, new version is officially released as ECM 1.3.2

Yesterday I had an informative meeting with Ivan Korshun about "what's new" in this upcoming version. Two main features are Emulation mode for concrete mails and DispatchSummary.aspx page.

Tip 1. First thing to remember is that DispatchSummary shows only current dispatch tasks, and doesn't show test task.

Tip 2. Another fun thing that I want to notice is understanding on generating and sending threads. Actually, there are 2 settings - NumberThreads and MaxGenerationThreads. Surprisingly, they are tied up with each other. For example, we can have 8 generating threads and 100 threads at all. This means, that we can generate 8 emails simultaneously. As soon as thread finishes generating email, it becomes a sending thread. Next free thread for generation is taken from the thread pool. And so on, until job is finished or until we reach end of pool.

Tip 3. Required Bandwidth = V/T. Amount of mails divided by time of sending (if only not local MTA is used).

All other information that we have discuseed, and consequently all dispatch real-time info that we can oversee, is described thoroughly in Sitecore ECM Tuning guide (http://sdn.sitecore.net/Products/ECM/ECM%201,-d-,3/Documentation.aspx). Looks like really powerful feature. Happy tuning!


Saturday, 10 March 2012

Following up ECM theme: Mystic "RedirectUrlPage.aspx" is added to links when "href" property starts from url not equal to BaseUrl. RedirectUrlPage does nothing but returns 302 redirect code and adds "Location" header with value that is taken from real url. I've also found out how really ECM works when sends messages - it creates a link to download (see previous post), then this link is just processed as each standard request to Sitecore, with all pipelines, and returned output is being processed by several methods like replacing tokens and link modifications. Then output is being sent to subscribers.

Thursday, 8 March 2012

Last couple of days I was buried in ECM code debug.



Some tips for future:

0. Processing is different for HTML mail and Newsletter. First one is regulated by HtmlMail, second one by WebPageMail. Both have one base class HtmlMailBase.

1. "Message Preview" composes an url and downloads it - to present you an actual email. Actions are the same as if you dispatch this email. This is relevant for WebPageMail, where HtmlMail just takes "Body" field value from message item.

2. Link to download an email is very easy to understand:

http://hostname/?sc_itemid=%7b9121BA1E-619A-4B84-BCB9-A1806F117810%7d&sc_lang=en&sc_device=%7bFE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3%7d&sc_mode=normal&sc_database=master&ec_recipient=sitecore%5cAdmin&ec_id=9033D12313D74836A7D5CECD015A3E82

http://hostname - equal to WebUtil.GetServerUrl(Context.Request.Url). You may check it in httpRequestBegin to make sure that correct hostname is resolved.

sc_itemid,sc_lang,sc_device,sc_mode,sc_database - properties of item that is chosen in "Body" ("Web Page") field of newsletter item. By default it is Newsletter Root under your newsletter item.

ec_recipient, ec_id - ECM properties, name of mail's PersonalizationContact and global EcmId.

3. When you put some links into the content, they are also transformed - sc_camp and ec_as are added there. sc_camp is email campaign ID, ec_as is ID of automation state (one of stored in AutomationStates table in Analytics db). More in Sitecore.Modules.EmailCampaign.HtmlMailBase.ModifyHrefLink

Lately, when user clicks some links, ec_as is processed for Analytics purposes, and as a nice tip, you may get current username using AnalyticsHelper.GetRecepient.

4. Tokens like $email$, $phone$ can be placed anywhere, even in links. Links are processed lately then tokens are replaced with actual values. One may define its own tokens in item, that is defined by ECM Manager root, Default Subscriber profile.

5. There are different URLs used by ECM. One is the url that you are launching Sitecore from - Context.Request.Url, and other is ECM Manager root setting BaseUrl. First is used to create this magic "DownloadLink" for message, second is used to create links inside a message.

6. Magical RegisterEmailOpened.aspx page, that is a source for 1-pixel image inserted in message automatically, returns 404 anyway and is used only for tracking purposes.