Skip to content

benquinlan-07/xperience-community-form-notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xperience Community: Form Notifications

Description

This package provides Xperience by Kentico administrators with an interface to manage form email notifications. While Kentico has developed autoresponder management into the Xperience by Kentico solution, this package was developed as an alternative to the current implementation specifically for developers upgrading clients from KX13 and older instances where users were able to manage email content and configuration more easily within the administration interface.

One particular feature of note within this extension is that it has been extended to support the use of adding form data into email templates by way of macro expressions. Similar to the behaviour of KX13 and prior versions, macro expressions defined in the recipients, subject or the content of the email will be resolved where they match a field name set within the form structure.

Xperience by Kentico Form Notifications

Requirements

Dependencies

Package Installation

Add the package to your application using the .NET CLI

dotnet add package XperienceCommunity.FormNotifications

or via the Package Manager

Install-Package XperienceCommunity.FormNotifications

Quick Start

  1. Install the NuGet package.

  2. Update your Program.cs to register the necessary services.

    using XperienceCommunity.FormNotifications;

    ...

    builder.Services.AddFormNotificationsExtensionServices();

Full Instructions

  1. Start your XbyK website.

  2. Log in to the administration site.

  3. Create or edit a form.

  4. Select the Emails option from the menu on the right side of the screen. Xperience by Kentico Form Notifications

  5. Configure your preferred notification settings.

  6. Submit the form.

  7. Watch the magic happen.

Advanced Features

Custom Email Message Transformation

You can create custom handlers to transform email messages before they are sent. This allows you to modify recipients, subject, body, headers, or add custom logic based on form data.

  1. Create a class that implements IFormNotificationEmailMessageHandler:
using System.Threading.Tasks;
using CMS.EmailLibrary;
using CMS.OnlineForms;
using XperienceCommunity.FormNotifications.Services;

public class CustomEmailMessageHandler : IFormNotificationEmailMessageHandler
{
    public Task<EmailMessage> TransformEmailMessageAsync(
        EmailMessage emailMessage, 
        BizFormItem bizFormItem, 
        bool isAutoresponder)
    {
        // Add a prefix to the subject
        emailMessage.Subject = $"[{bizFormItem.BizFormInfo.FormDisplayName}] {emailMessage.Subject}";
        
        // Add BCC recipients
        emailMessage.BCC = "archive@company.com";
        
        // Add custom logic based on form type
        if (isAutoresponder)
        {
            // Custom logic for autoresponders
        }
        else
        {
            // Custom logic for notifications
        }
        
        return Task.FromResult(emailMessage);
    }
}
  1. Register your handler in Program.cs:
builder.Services.AddTransient<IFormNotificationEmailMessageHandler, CustomEmailMessageHandler>();

Multiple handlers can be registered and they will be executed in the order they are registered.

About

Extension for Xperience by Kentico to allow for easy configuration of emails for sending autoresponders and notifications in a similar format to KX13.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors