3

Previously in Exm 3.5 we send customize email using AsyncSendingManager code.

AsyncSendingManager(messageItem).SendStandardMessage(recipientId)

In Exm 9.0.1, there is no implementation this class. Is there any option available for sending customize email from exm?

5

In Sitecore 9.0.1, the way that Sitecore servers send messages through EXM has changed a bit due to the introduction of Rebus Messaging Service.

To send emails now, you'll want to instantiate the client api service.

IClientApiService _clientApiService;

public ClassConstructor(IClientApiService clientApiService)
{
  _clientApiService = clientApiService;

  var messageInfo = new AutomatedMessage();
  messageInfo.MessageId = messageId; //Guid of Message
  messageInfo.ContactIdentifier = contactIdentifier; //Contact Identifier
  messageInfo.CustomTokens = dictionaryOfTokens //Custom Tokens
  messageInfo.TargetLanguage = language //Language

  _clientApiService.SendAutomatedMessage(messageInfo);
}

This will send the custom message through EXM as usual.

For reference, there are other methods that the Client API uses as well:

namespace Sitecore.EmailCampaign.Cd.Services
{
  public interface IClientApiService
  {
    void SendAutomatedMessage(AutomatedMessage automatedMessage);

    void Subscribe(SubscribeMessage subscribeMessage);

    void Unsubscribe(UnsubscribeMessage unsubscribeMessage);

    void ConfirmSubscription(ConfirmSubscriptionMessage confirmSubscriptionMessage);

    void RegisterEmailOpen(EmailOpenMessage emailOpenMessage);
  }
}
  • I am using the code above to trigger the delivery of messages successfully, but we have some arbitrary custom tokens in the message that we're trying to fill using the CustomTokens dictionary and they never get filled. Is it sufficient for the Dictionary key to match the token in the email, as $key$ or do the custom tokens have to be xDB facets? – Richard Hauer Oct 31 '18 at 10:19

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.