4

For a large number of implementations we use business logic to determine the actual body of an email and then send it through either smtp (or a custom save action in WFFM).

But would it make sense to use EXM for this behavior? The goal would be to use the reporting capabilities provided by EXM, not the personalization/editing capabilities.

The e-mail would consist of a recipient and body that are pushed into EXM for a specific template and are then dispatched. I probably need an Engagement plan to trigger this email.

Would this be a good (and feasible) approach? The other option would be to use a tool like SendGrid that also provides bounce and open rate information. But if we can use Sitecore for this, that would be great.

2

Yes, EXM is intended for this purpose among others. With EXM you can schedule dispatched emails (composed email sent to a large body of recipients), you can send triggered emails (the user does something on that site that sends them a one-off email), and you can also set up subscriptions.

With EXM, you are actually composing an email in a very similar fashion to how you compose a web page in Sitecore. You can have sub-layouts and renderings that drive the business logic that constructs the email, and then mix that with the personalization of each Contact so that you can tailor the email for them (I know you said you weren't interested, but the feature is there OOTB).

After doing so, you gain all of the reporting features that come along with it, including Open rates, click rates, deliverability, device, location (assuming you have subscribed to device/location detection).


How Does It Work

Currently, in EXM (version 3 through 3.4), Emails are attached to a campaign that is attached to an already built out Engagement plan that is used for the sending of that email. You can customize that engagement plan, however, it has been my experience that the default plan serves most all of the purposes.

There is also a pretty well built out Client API that allows you to quickly send out triggered emails from the content delivery server to a recipient in kind of an on-the-fly way.

If you have the ability to, I highly recommend using Sitecore 8.2 and EXM 3.4. However, if you still have a lower version of Sitecore 8, then you probably want to use EXM 3.3 (which requires Sitecore 8.1 Update-3) This does require a subscription to Sitecore's Email Delivery service which is provided via Dyn.

Dyn Support Ending Q4 2017 (EXM 3.0 - EXM 3.3)

However, support for sending mail through Dyn (which is the company that sends mail on behalf of Sitecore's EXM) is ending this year. This means that you won't be able to use EXM 3.3 or below without bringing your own Message Transfer Agent (MTA) which is totally possible by utilizing the CustomSMTP.config for EXM. SendGrid can be used as an MTA with EXM.

Sitecore Email Cloud Service (EXM 3.4)

Sitecore is pushing clients wanting to use EXM towards utilizing EXM 3.4, which requires a subscription to Sitecore's Email Cloud service. The purpose behind this is to increase the level of Reputation Management that is needed in order ensure your emails sent aren't marked as SPAM. Previously, with Dyn, there has been a number of deliverability issues that have affected reputation scores on mail. To fix this, Sitecore has teamed up with Spark Post to provide a white label MTA.


Technical Background

Every mail message that Sitecore EXM sends out has an Item representing it. If it's a triggered email, where the item itself might be utilized over and over, but the content changes, then you would just reference that same Triggered Email. So the first step is to create the item that represents the Mail email you're sending.

Very Simple Email Example

Let's say you have a triggered email, where you already have a mechanism for creating the markup of the email. One way that you can do this is to have an EXM Mail Message item that consists of nothing more than a Rich Text Box field.

  • Just prior to sending the message you desire, you use standard Sitecore API to edit the field value for the Rich Text Box to include the email HTML needed to satisfy the body of the email. After we're done, we want to ensure we get the MailMessage item, which contains all of the information and details we need around constructing the actual mail message.

    MessageItem message = Sitecore.Modules.EmailCampaign.Factory.GetMessage(messageItem.ID.ToString());

  • Next step is to get the Contact that you want to send to. The recipient must be in Sitecore as an xDB contact already. If they are not, there are several ways to accomplish this (outside scope of this answer). For EXM, we want to ensure we're using the xDB Contact notation, which is done via:

    var recipientId = new XdbContactId(xdbContact.ContactId);

  • Lastly, we want to send the email, which is a simple API method. The third argument is if we want the message to be sent async or not.

    ClientApi.SendStandardMessage(message.MessageId, recipientId, true);

Given that the EXM configuration is appropriately done, this will immediately dispatch an email to this user.

Complex Emails Different for Each Contact

The process for sending a complex email, such as you hint at, where the content is significantly different, is really no different than the above process with maybe an additional step.

Basically, what you're looking to do specifically is create a sublayout/component that is applied to the email that contains the logic needed to build and differentiate the email. There's an assumption here that the logic and workflow for creating the body of an email. Same as if you're building a component for a web page. The logic you need creates output that you then display to the mail message, just like you would for any other web page.

Then when an email is sent (either Triggered or in batch), you can fetch the Contact information, and build the email based off of it as needed.

  • Thanks for this information already. And I guess it is indeed possible, but I'm still wondering what I would need to use to trigger an EXM email and inject all parameters through API, so basically the body as well as recipient information. As this can not be done through the composing way that you would typically do in ExM/Sitecore... As every mail will be significantly different. – Kris Verheire Jan 23 '17 at 13:58
  • @KrisVerheire I've adjusted my answer to try and be a bit more specific. As with anything, there are a few different ways that you can shave this yak. What's important is having an understanding on what the requirements and use cases are and coming up with a solution. – Pete Navarra Jan 23 '17 at 16:55
  • Thanks for the further clarification. I guess we'll indeed need to make due with what is available on API level tot work on this requirements. And indeed, possibly through a number of different approaches. – Kris Verheire Jan 24 '17 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.