Create a custom message type class
The EXM module lets developers create and use custom message types, which also require a custom type resolver.
The Email Experience Manager module lets developers create and use custom types of message items. The default EXM message types are mapped to the appropriate class in the code by the TypeResolver class. To use a custom message type class, you must also create a custom type resolver to map your message type correctly.
To create a custom message type class:
Derive a custom message type class from either the
MessageItemclass or one of its descendants:The
TextMailclassThe
HtmlMailclassThe
WebPageMailclassThe
ABTestMessageclass
Define a message template for the new message type.
Implement the
Clone()method on your custom type, even when it does not derive from the message Item class.Derive a custom type resolver class from the
TypeResolverclass.Override the
GetCorrectMessageObjectmethod in the class that you derived from theTypeResolverclass.
Example:
public class NewMail : MessageItem
{
public static bool IsCorrectMessageItem(Item item)
{
return ItemUtilExt.IsTemplateDescendant(item, TemplateIds.NewMessageTemplate);
}
...
}
public class NewTypeResolver : TypeResolver
{
public override MessageItem GetCorrectMessageObject(Item item)
{
var result = NewMail.FromItem(item);
return result != null ? result : base.GetCorrectMessageObject(item);
}
...
}