Skip To Content

Kentico Extensibility: How to Enable Double Opt-In with Kentico Forms

Kentico EMS provides the ability to use double opt-in with email sign-ups. When this feature is enabled, Kentico verifies that an email is valid and that its owner really wants to receive a newsletter. It does this by sending an email confirmation link that the user must open. 

This is a great feature because it protects email lists from having invalid email addresses and protects users from being signed up without their consent. Double opt-in reduces the risk of bounced emails as well as the risk of users reporting messages as spam. In short, using Kentico's double opt-in feature will protect your email sender reputation.

When using the newsletter subscription web part or widget, Kentico's double opt-in feature works out-of-the-box. However, marketers may want to use custom online forms for newsletter sign up so that they can ask for additional information. In this case, a marketer would typically create a Kentico online form, and then create a marketing automation workflow that adds emails from the form to the subscription list.

Here is an illustration of a very simple marketing automation workflow that checks the value of the form’s confirmation box and then adds the submitted email address to a newsletter:

kentico admin marketing automation workflow

However, if using marketing automation to populate newsletter subscriptions lists in Kentico 12 or earlier, marketers will discover that Kentico’s double opt-in feature is not used. Subscribers that are added using a Kentico form via marketing automation are automatically marked as “confirmed.”

email subscription list

This could be a startling surprise for marketers, who may have assumed that Kentico’s double opt-in feature would work in conjunction with online forms.

However, the good news is that this issue has been resolved in Kentico 12 Service Pack. Additionally, if you are still running an earlier Kentico version, there’s still good news: Because Kentico is highly extensible – that is, its robust API makes it easy add and customize functionality – there is a simple way to enable this feature using a custom marketing automation action.

Custom marketing automation action

A custom action is a type of workflow step that is executed in a marketing automation workflow. By creating a custom action, we can replace the out-of-the-box “Newsletter subscription” action with one that instead uses the double opt-in confirmation option. Kentico provides a great overview on developing custom marketing automation actions. The basic idea is to create a custom .NET class that is derived from CMS.Automation.AutomationAction and implements a custom Execute() method. The custom action can also have custom properties, so that it can be configured in the workflow designer.

When we created the custom Newsletter subscription action, it was easiest to start by decompiling the out-of-the-box version, CMS.Newsletters.NewsletterSubscriptionAction, which clarified what was missing in the out-of-the-box code: When creating the SubscribeSettings object, the AllowOptIn and SendConfirmationEmail properties were always set to false.

SubscribeSettings subscribeSettings = new SubscribeSettings

{

                     SendConfirmationEmail = false,

                     RemoveAlsoUnsubscriptionFromAllNewsletters = false,

                     AllowOptIn = false

};

To serve our purposes, we were able to create a basic version of this marketing automation action that instead set the AllowOptIn and SendConfirmationEmail properties to true.

Register the custom action

After creating a new custom marketing automation action, it’s necessary to register it with Kentico in the Marketing Automation module. The registration requires a unique code name, an assembly name containing the custom action, and a fully-qualified class name.

marketing automation action properties in Kentico admin

Once the custom action is registered, you will then be able to use it in the marketing automation workflow designer to register newsletter subscribers:

Marketing automation flow chart

After implementing the workflow using the new custom action, new subscribers are added with the “Waiting for confirmation” status:

waiting to confirm subscription list

This is just one of the many examples of Kentico’s support for deep customizations. The platform’s extensibility, probably its best kept secret, continues to allow us to meet the unique needs of our customers, when the limitations of many other platforms would have stopped us in our tracks.

Want to learn about more examples of Kentico’s extensibility? Check out my recent article here. You can also drop me a line on Twitter (@HeyMikeWills), or contact our BlueModus team of experts today.