1

I'd like to create an automated email campaign in EXM. I'd like this campaign to be triggered when a form is submitted. This form is not a Sitecore Form, it is not placed in a Sitecore website. Is this possible?

3
  • Have you looked at this? doc.sitecore.com/xp/en/developers/exm/90/… Commented Nov 6, 2023 at 14:17
  • I think it possible. You need to push the data from your form to the automated message queue found in the messaging database. From there, the automated handler will trigger the email sending process. Commented Nov 6, 2023 at 17:39
  • You should have a mechanism in place that triggers the handler in Sitecore which sends the automated email. It can be an api request or an entry in a database table/queue. Commented Nov 7, 2023 at 17:09

1 Answer 1

0

As mentioned in the comments already you can do this if you create an endpoint on your Sitecore site that can trigger the mail. To do this you can use the EXM api as described in the docs: https://doc.sitecore.com/xp/en/developers/exm/103/email-experience-manager/sending-email-campaigns-programmatically.html. The example from there for automated emails:

IMessageBus<AutomatedMessagesBus> automatedMessageBus = ServiceLocator.ServiceProvider.GetService<IMessageBus<AutomatedMessagesBus>>(); AutomatedMessage automatedMessage = new AutomatedMessage() { ContactIdentifier = contactIdentifier, MessageId = emailCampaignId }; automatedMessageBus.Send(automatedMessage); 

Trigger this endpoint when the form has been submitted and your campaign should be send.

If you need something more complex, you can also have a look at the code from the "Forms Extensions" module that has a SendMail submit action capable of replacing tokens in regular EXM mails with form data. Although this is a submit action and as such attached to Sitecore Forms, it might help or inspire you to achieve what is needed. That code can be found on Github.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.