How do I send non-campaign emails with sitecore’s ECM ?! That would be so cool! Hold on… the ECM is used for campaigns, for newsletter sending, for sending emails to multiple users. I should use a different email server for every-day emails… Yeah, then I’ll just check on this for fun I guess…
For sending campaign emails, Sitecore ECM makes use of two pipelines: DispatchNewsletter and SendEmail.
I am not interested in the first one, just by its name I think I can safely assume it’s irrelevant to what I’m trying to do, I don’t have a newsletter.
Going forward, it looks like SendEmail consists of two processors: FillEmail and SendEmail. After some mild testing and debugging, I’m pretty sure FillEmail will replace email tokens and SendEmail will use SendingManager to send the email.
Sitecore.Modules.EmailCampaign.SendingManager looks to already offer a couple of methods for sending emails.
SendingManager.SendMessage(), will pass through the DispatchNewsletter pipeline and that doesn’t help me because that will try to send the email through the same process as sending a newsletter. Hence, Sitecore will move my email to the processing folder.
SendingManager.SendStandardMessage(Contact), does not move the email from drafts to processing but it still calls some processors in the DispatchNewsletter pipeline. It will call DeployAnalytics, try to create Campaigns, Engagement plans, Subject MVTs. There’s a lot of overhead with SendStandardMessage so I don’t like this one either. Additionally I came across the following jewel: The UPDATE statement conflicted with the FOREIGN KEY constraint “FK_Automation_Campaign”. The conflict occurred in database “Sitecore_Analytics”, table “dbo.Campaigns”, column ‘CampaignId’..
That leaves me having to write my own.